From cbe77cb87ff2394e1c2f657e9b7a4f8f4bfbb75f Mon Sep 17 00:00:00 2001 From: starlight36 Date: Sat, 7 Nov 2015 16:38:34 +0800 Subject: [PATCH 1/5] fix some bugs on android. --- .gitignore | 32 +++------------------------- components/NavBarContainer.js | 8 ++++--- components/NavBarContent.js | 2 +- index.js | 40 +++++++++++++++++++++++------------ 4 files changed, 36 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 60b82c7..60c5c50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,4 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules - -# OSX +node_modules/ +.idea/ +*.iml .DS_Store diff --git a/components/NavBarContainer.js b/components/NavBarContainer.js index 7fda8ff..9e396df 100644 --- a/components/NavBarContainer.js +++ b/components/NavBarContainer.js @@ -42,16 +42,18 @@ var NavBarContainer = React.createClass({ // We render both the current and the previous navbar (for animation) render: function() { return ( - + + {leftCorner} {titleComponent} {rightCorner} diff --git a/index.js b/index.js index e9e4350..7666364 100644 --- a/index.js +++ b/index.js @@ -123,11 +123,13 @@ var Router = React.createClass({ render: function() { - // Status bar color - if (this.props.statusBarColor === "black") { - StatusBarIOS.setStyle(0); - } else { - StatusBarIOS.setStyle(1); + // Status bar color, if on iOS + if (React.Platform.OS == 'ios') { + if (this.props.statusBarColor === "black") { + StatusBarIOS.setStyle(0); + } else { + StatusBarIOS.setStyle(1); + } } var navigationBar; @@ -147,14 +149,26 @@ var Router = React.createClass({ /> } - return ( - - ) + if (React.Platform.OS == 'ios') { + return ( + + ); + } else { + return ( + Navigator.SceneConfigs.FadeAndroid} + navigationBar={navigationBar} + renderScene={this.renderScene} + onDidFocus={this.onDidFocus} + /> + ); + } } }); From 61c1f261b9476ec7693055249676a3a97ad1fd62 Mon Sep 17 00:00:00 2001 From: starlight36 Date: Sat, 7 Nov 2015 16:52:37 +0800 Subject: [PATCH 2/5] fix some Navbar layout on android. --- components/NavBarContainer.js | 2 +- components/NavBarContent.js | 6 +++--- index.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/NavBarContainer.js b/components/NavBarContainer.js index 9e396df..1aba559 100644 --- a/components/NavBarContainer.js +++ b/components/NavBarContainer.js @@ -73,7 +73,7 @@ var styles = StyleSheet.create({ top: 0, left: 0, right: 0, - height: 64, + height: React.Platform.OS == 'ios' ? 64 : 48, backgroundColor: '#5589B7' } }); diff --git a/components/NavBarContent.js b/components/NavBarContent.js index 6871d07..048be56 100644 --- a/components/NavBarContent.js +++ b/components/NavBarContent.js @@ -137,17 +137,17 @@ var styles = StyleSheet.create({ top: 0, left: 0, right: 0, - height: 64, // Default iOS navbar height + height: React.Platform.OS == 'ios' ? 64 : 48, // Default iOS navbar height justifyContent: 'center', alignItems: 'center', flexDirection: 'row', - paddingTop: 13 + paddingTop: React.Platform.OS == 'ios' ? 13 : 0 }, navbarText: { color: 'white', fontSize: 17, margin: 10, - marginTop: 14, + marginTop: React.Platform.OS == 'ios' ? 14 : 10, fontWeight: '600', textAlign: 'center', alignItems: 'center', diff --git a/index.js b/index.js index 7666364..e581210 100644 --- a/index.js +++ b/index.js @@ -177,7 +177,7 @@ var styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#F5FCFF', - marginTop: 64 + marginTop: React.Platform.OS == 'ios' ? 64 : 48 }, }); From ff7d38d5427ad4a2789746ba6eefabbb41204dbe Mon Sep 17 00:00:00 2001 From: starlight36 Date: Mon, 16 Nov 2015 14:02:47 +0800 Subject: [PATCH 3/5] reset .gitignore --- .gitignore | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 60c5c50..60b82c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,30 @@ -node_modules/ -.idea/ -*.iml +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +node_modules + +# OSX .DS_Store From e2cf0d7e02b2bcfc62c0f2d40e77a3f0b1ce345b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=80=9D=E8=B4=A4?= Date: Fri, 26 Feb 2016 10:31:51 +0800 Subject: [PATCH 4/5] update fix 7, add isRoot View support. --- README.md | 4 +++- index.js | 5 +++++ package.json | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bc06e87..4b36338 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ React Native Router =================== Awesome navigation for your React Native app. +** This is a React Native Router fix version. It can be used in Android project. ** + ![Twitter navigation](http://tristanedwards.me/u/react-native-router/native-router.gif) Install @@ -9,7 +11,7 @@ Install Make sure that you are in your React Native project directory and run: -```npm install react-native-router --save``` +```npm install react-native-router-fix --save``` Usage ----- diff --git a/index.js b/index.js index e581210..573ac12 100644 --- a/index.js +++ b/index.js @@ -68,6 +68,10 @@ var Router = React.createClass({ this.customAction(opts); }.bind(this); + var isRootView = function() { + return this.state.route.index == 1; + }.bind(this); + var didStartDrag = function(evt) { var x = evt.nativeEvent.pageX; if (x < 28) { @@ -114,6 +118,7 @@ var Router = React.createClass({ toRoute={goForward} toBack={goBackwards} reset={goToFirstRoute} + isRootView={isRootView} customAction={customAction} /> diff --git a/package.json b/package.json index 57c6ec7..7bdf76e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "react-native-router", - "version": "0.2.1", + "name": "react-native-router-fix", + "version": "0.2.1-fix-7", "description": "Awesome navigation for your native app.", "main": "index.js", "scripts": { @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/t4t5/react-native-router.git" + "url": "https://github.com/starlight36/react-native-router.git" }, "keywords": [ "react", From 63d1278f1a60caaa8fa8e4feb9ac9d19eb8933dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=80=9D=E8=B4=A4?= Date: Fri, 26 Feb 2016 11:02:02 +0800 Subject: [PATCH 5/5] fix to 10 --- .gitignore | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 60b82c7..13d2f90 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ node_modules # OSX .DS_Store + +.idea/ \ No newline at end of file diff --git a/package.json b/package.json index 7bdf76e..052259f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-router-fix", - "version": "0.2.1-fix-7", + "version": "0.2.1-fix-10", "description": "Awesome navigation for your native app.", "main": "index.js", "scripts": {