diff --git a/Example/.babelrc b/Example/.babelrc index 38fda4dd9..91e4606a6 100644 --- a/Example/.babelrc +++ b/Example/.babelrc @@ -1,3 +1,8 @@ { - "presets": ["react-native-stage-0/decorator-support"] + "presets": [ + "react-native" + ], + "plugins": [ + "transform-decorators-legacy" + ] } diff --git a/Example/.flowconfig b/Example/.flowconfig index c693a48ff..a76425eb4 100644 --- a/Example/.flowconfig +++ b/Example/.flowconfig @@ -36,11 +36,12 @@ suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-8]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-8]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError unsafe.enable_getters_and_setters=true [version] -^0.38.0 +^0.42.0 diff --git a/Example/Example.js b/Example/Example.js index 1cd3f7ee8..2877b6637 100644 --- a/Example/Example.js +++ b/Example/Example.js @@ -49,7 +49,7 @@ const reducerCreate = params => { class Example extends Component { render() { return ( - + diff --git a/Example/android/app/BUCK b/Example/android/app/BUCK index 2ebdb984b..c8f560323 100644 --- a/Example/android/app/BUCK +++ b/Example/android/app/BUCK @@ -1,5 +1,3 @@ -import re - # To learn about Buck see [Docs](https://buckbuild.com/). # To run your application with Buck: # - install Buck @@ -11,8 +9,9 @@ import re # lib_deps = [] + for jarfile in glob(['libs/*.jar']): - name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) + name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] lib_deps.append(':' + name) prebuilt_jar( name = name, @@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']): ) for aarfile in glob(['libs/*.aar']): - name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) + name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] lib_deps.append(':' + name) android_prebuilt_aar( name = name, @@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']): ) android_library( - name = 'all-libs', - exported_deps = lib_deps + name = "all-libs", + exported_deps = lib_deps, ) android_library( - name = 'app-code', - srcs = glob([ - 'src/main/java/**/*.java', - ]), - deps = [ - ':all-libs', - ':build_config', - ':res', - ], + name = "app-code", + srcs = glob([ + "src/main/java/**/*.java", + ]), + deps = [ + ":all-libs", + ":build_config", + ":res", + ], ) android_build_config( - name = 'build_config', - package = 'com.example', + name = "build_config", + package = "com.example", ) android_resource( - name = 'res', - res = 'src/main/res', - package = 'com.example', + name = "res", + package = "com.example", + res = "src/main/res", ) android_binary( - name = 'app', - package_type = 'debug', - manifest = 'src/main/AndroidManifest.xml', - keystore = '//android/keystores:debug', - deps = [ - ':app-code', - ], + name = "app", + keystore = "//android/keystores:debug", + manifest = "src/main/AndroidManifest.xml", + package_type = "debug", + deps = [ + ":app-code", + ], ) diff --git a/Example/android/app/build.gradle b/Example/android/app/build.gradle index 7d655dc7b..b89df76ed 100644 --- a/Example/android/app/build.gradle +++ b/Example/android/app/build.gradle @@ -58,7 +58,7 @@ import com.android.build.OutputFile * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"] + * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] diff --git a/Example/android/app/proguard-rules.pro b/Example/android/app/proguard-rules.pro index 48361a901..6e8516c8d 100644 --- a/Example/android/app/proguard-rules.pro +++ b/Example/android/app/proguard-rules.pro @@ -50,6 +50,10 @@ -dontwarn com.facebook.react.** +# TextLayoutBuilder uses a non-public Android constructor within StaticLayout. +# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. +-dontwarn android.text.StaticLayout + # okhttp -keepattributes Signature diff --git a/Example/android/keystores/BUCK b/Example/android/keystores/BUCK index 15da20e6b..88e4c31b2 100644 --- a/Example/android/keystores/BUCK +++ b/Example/android/keystores/BUCK @@ -1,8 +1,8 @@ keystore( - name = 'debug', - store = 'debug.keystore', - properties = 'debug.keystore.properties', - visibility = [ - 'PUBLIC', - ], + name = "debug", + properties = "debug.keystore.properties", + store = "debug.keystore", + visibility = [ + "PUBLIC", + ], ) diff --git a/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index c5f946920..273f724d7 100644 --- a/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -99,13 +99,6 @@ ReferencedContainer = "container:Example.xcodeproj"> - - - - diff --git a/Example/package.json b/Example/package.json index e60796a0a..5dffffbf0 100644 --- a/Example/package.json +++ b/Example/package.json @@ -13,7 +13,7 @@ "react": "16.0.0-alpha.6", "react-native": "0.44.0", "react-native-button": "^2.0.0", - "react-native-router-flux": "^4.0.0-beta.8", + "react-native-router-flux": "4.0.0-beta.10", "react-navigation": "^1.0.0-beta.11" }, "devDependencies": { diff --git a/Example/yarn.lock b/Example/yarn.lock index 4e20bcaa5..74e0f80ae 100644 --- a/Example/yarn.lock +++ b/Example/yarn.lock @@ -3233,20 +3233,9 @@ react-native-drawer-layout@1.3.2: dependencies: react-native-dismiss-keyboard "1.0.0" -react-native-router-flux@../: +react-native-router-flux@4.0.0-beta.9: version "4.0.0-beta.9" - dependencies: - mobx "^3.1.16" - mobx-react "^4.2.1" - opencollective "^1.0.3" - prop-types "^15.5.10" - react-native-button "^2.0.0" - react-native-router-flux "4.0.0-beta.7" - react-navigation "^1.0.0-beta.11" - -react-native-router-flux@4.0.0-beta.7: - version "4.0.0-beta.7" - resolved "https://registry.yarnpkg.com/react-native-router-flux/-/react-native-router-flux-4.0.0-beta.7.tgz#51d61dfe6b70df7da97bf96d38b8b13d7ba1c52d" + resolved "https://registry.yarnpkg.com/react-native-router-flux/-/react-native-router-flux-4.0.0-beta.9.tgz#8fc90189b254467a2e673ccafebb62e20c966b79" dependencies: mobx "^3.1.16" mobx-react "^4.2.1" diff --git a/dist/NavBar.js b/dist/NavBar.js index 0332041e2..e256eb901 100644 --- a/dist/NavBar.js +++ b/dist/NavBar.js @@ -20,6 +20,7 @@ styles.backButton, state.leftButtonStyle]; var buttonImage=state.backButtonImage||_back_chevron2.default; +var tintColor=state.tintColor||state.navBarButtonColor||state.headerTintColor; var onPress=state.onBack; if(onPress){ onPress=onPress.bind(null,state); @@ -28,7 +29,7 @@ onPress=_navigationStore2.default.pop; } var text=state.backTitle? -_react2.default.createElement(_reactNative.Text,{style:textButtonStyle,__source:{fileName:_jsxFileName,lineNumber:31}}, +_react2.default.createElement(_reactNative.Text,{style:textButtonStyle,__source:{fileName:_jsxFileName,lineNumber:32}}, state.backTitle): null; @@ -37,15 +38,16 @@ return( _react2.default.createElement(_reactNative.TouchableOpacity,{ testID:'backNavButton', style:{position:'absolute',top:0,left:0,height:50,width:70}, -onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:37}}, +onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:38}}, -_react2.default.createElement(_reactNative.View,{style:style,__source:{fileName:_jsxFileName,lineNumber:42}}, +_react2.default.createElement(_reactNative.View,{style:style,__source:{fileName:_jsxFileName,lineNumber:43}}, buttonImage&&!state.hideBackImage&&_react2.default.createElement(_reactNative.Image,{ source:buttonImage, style:[ styles.backButtonImage, state.barButtonIconStyle, -state.leftButtonIconStyle],__source:{fileName:_jsxFileName,lineNumber:43}}), +state.leftButtonIconStyle, +{tintColor:tintColor}],__source:{fileName:_jsxFileName,lineNumber:44}}), @@ -73,7 +75,7 @@ state,{ key:'leftNavBarBtn', testID:'leftNavButton', style:[].concat(style,leftButtonStyle), -textStyle:textStyle,__source:{fileName:_jsxFileName,lineNumber:71}}))); +textStyle:textStyle,__source:{fileName:_jsxFileName,lineNumber:73}}))); } @@ -85,16 +87,16 @@ _react2.default.createElement(_reactNative.TouchableOpacity,{ key:'leftNavBarBtn', testID:'leftNavButton', style:style, -onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:84}}, +onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:86}}, -leftTitle&&_react2.default.createElement(_reactNative.Text,{style:textStyle,__source:{fileName:_jsxFileName,lineNumber:90}}, +leftTitle&&_react2.default.createElement(_reactNative.Text,{style:textStyle,__source:{fileName:_jsxFileName,lineNumber:92}}, leftTitle), -!leftTitle&&buttonImage&&_react2.default.createElement(_reactNative.View,{style:{flex:1,justifyContent:'center',alignItems:'flex-start'},__source:{fileName:_jsxFileName,lineNumber:94}}, +!leftTitle&&buttonImage&&_react2.default.createElement(_reactNative.View,{style:{flex:1,justifyContent:'center',alignItems:'flex-start'},__source:{fileName:_jsxFileName,lineNumber:96}}, menuIcon||_react2.default.createElement(_reactNative.Image,{ source:buttonImage, -style:[state.leftButtonIconStyle||styles.defaultImageStyle,{tintColor:tintColor}],__source:{fileName:_jsxFileName,lineNumber:95}})))); +style:[state.leftButtonIconStyle||styles.defaultImageStyle,{tintColor:tintColor}],__source:{fileName:_jsxFileName,lineNumber:97}})))); @@ -128,6 +130,7 @@ var style=[styles.rightButton,state.rightButtonStyle]; var textStyle=[styles.barRightButtonText,state.rightButtonTextStyle]; var rightButtonStyle=[styles.defaultImageStyle,state.rightButtonIconStyle]; var rightTitle=state.getRightTitle?state.getRightTitle(state):getValue(state.rightTitle,state); +var tintColor=state.tintColor||state.navBarButtonColor||state.headerTintColor; if(state.rightButton||state.right){ var Button=state.rightButton||state.right; @@ -137,7 +140,7 @@ state,{ key:'rightNavBarBtn', testID:'rightNavButton', style:style, -textButtonStyle:textStyle,__source:{fileName:_jsxFileName,lineNumber:135}}))); +textButtonStyle:textStyle,__source:{fileName:_jsxFileName,lineNumber:138}}))); } @@ -151,7 +154,7 @@ if(!menuIcon){ menuIcon= _react2.default.createElement(_reactNative.Image,{ source:buttonImage, -style:rightButtonStyle,__source:{fileName:_jsxFileName,lineNumber:152}}); +style:rightButtonStyle,__source:{fileName:_jsxFileName,lineNumber:155}}); } @@ -164,16 +167,16 @@ _react2.default.createElement(_reactNative.TouchableOpacity,{ key:'rightNavBarBtn', testID:'rightNavButton', style:style, -onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:163}}, +onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:166}}, -rightTitle&&_react2.default.createElement(_reactNative.Text,{style:textStyle,__source:{fileName:_jsxFileName,lineNumber:169}}, +rightTitle&&_react2.default.createElement(_reactNative.Text,{style:textStyle,__source:{fileName:_jsxFileName,lineNumber:172}}, rightTitle), -!rightTitle&&buttonImage&&_react2.default.createElement(_reactNative.View,{style:{flex:1,justifyContent:'center',alignItems:'flex-end'},__source:{fileName:_jsxFileName,lineNumber:173}}, +!rightTitle&&buttonImage&&_react2.default.createElement(_reactNative.View,{style:{flex:1,justifyContent:'center',alignItems:'flex-end'},__source:{fileName:_jsxFileName,lineNumber:176}}, menuIcon||_react2.default.createElement(_reactNative.Image,{ source:buttonImage, -style:state.rightButtonIconStyle||styles.defaultImageStyle,__source:{fileName:_jsxFileName,lineNumber:174}})))); +style:[state.rightButtonIconStyle||styles.defaultImageStyle,{tintColor:tintColor}],__source:{fileName:_jsxFileName,lineNumber:177}})))); diff --git a/dist/Router.js b/dist/Router.js index 530a0de44..66347088d 100644 --- a/dist/Router.js +++ b/dist/Router.js @@ -124,8 +124,8 @@ if(leftButtonImage||backButtonImage||backTitle||leftTitle||params.renderLeftButt backButtonTextStyle||onLeft||navigationParams.leftTitle||navigationParams.onLeft||navigationParams.leftButtonImage|| navigationParams.backButtonImage||navigationParams.backTitle){ res.headerLeft=getValue(navigationParams.left||navigationParams.leftButton||params.renderLeftButton,_extends({},params,navigationParams,screenProps))|| -_react2.default.createElement(LeftNavBarButton,_extends({},params,navigationParams,componentData,{__source:{fileName:_jsxFileName,lineNumber:127}}))||( -init?null:_react2.default.createElement(LeftNavBarButton,_extends({},params,navigationParams,screenProps,componentData,{__source:{fileName:_jsxFileName,lineNumber:128}}))); +onLeft&&(leftTitle||navigationParams.leftTitle||leftButtonImage)&&_react2.default.createElement(LeftNavBarButton,_extends({},params,navigationParams,componentData,{__source:{fileName:_jsxFileName,lineNumber:127}}))||( +init?null:(0,_NavBar.renderBackButton)(_extends({},params,navigationParams,screenProps))); } if(back){ diff --git a/package.json b/package.json index a113d6c29..eb6edd185 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "react-native-router-flux", - "version": "4.0.0-beta.9", + "version": "4.0.0-beta.10", "description": "React Native Router using Flux architecture", "repository": { "type": "git", "url": "https://github.com/aksonov/react-native-router-flux" }, "license": "ISC", - "main": "dist/index.js", + "main": "src/index.js", "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "postinstall": "./node_modules/.bin/opencollective postinstall", @@ -24,8 +24,9 @@ "react-navigation": "^1.0.0-beta.11" }, "devDependencies": { - "babel-jest": "20.0.3", "babel-eslint": "^6.0.3", + "babel-jest": "20.0.3", + "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-preset-react-native": "2.0.0", "babel-preset-react-native-stage-0": "^1.0.1", "eslint": "^2.8.0", diff --git a/src/NavBar.js b/src/NavBar.js index acb75ad8d..92ba501b6 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -20,6 +20,7 @@ export function renderBackButton(state) { state.leftButtonStyle, ]; const buttonImage = state.backButtonImage || _backButtonImage; + const tintColor = state.tintColor || state.navBarButtonColor || state.headerTintColor; let onPress = state.onBack; if (onPress) { onPress = onPress.bind(null, state); @@ -46,6 +47,7 @@ export function renderBackButton(state) { styles.backButtonImage, state.barButtonIconStyle, state.leftButtonIconStyle, + { tintColor } ]} /> } @@ -128,6 +130,7 @@ export const RightButton = (state) => { const textStyle = [styles.barRightButtonText, state.rightButtonTextStyle]; const rightButtonStyle = [styles.defaultImageStyle, state.rightButtonIconStyle]; const rightTitle = state.getRightTitle ? state.getRightTitle(state) : getValue(state.rightTitle, state); + const tintColor = state.tintColor || state.navBarButtonColor || state.headerTintColor; if (state.rightButton || state.right) { const Button = state.rightButton || state.right; @@ -173,7 +176,7 @@ export const RightButton = (state) => { {!rightTitle && buttonImage && {menuIcon || } diff --git a/src/Router.js b/src/Router.js index 053fe5b78..8c9a40306 100644 --- a/src/Router.js +++ b/src/Router.js @@ -124,8 +124,8 @@ function createNavigationOptions(params) { || backButtonTextStyle || onLeft || navigationParams.leftTitle || navigationParams.onLeft || navigationParams.leftButtonImage || navigationParams.backButtonImage || navigationParams.backTitle) { res.headerLeft = getValue(navigationParams.left || navigationParams.leftButton || params.renderLeftButton, { ...params, ...navigationParams, ...screenProps }) - || - || (init ? null : ); + || (onLeft && (leftTitle || navigationParams.leftTitle || leftButtonImage) && ) + || (init ? null : renderBackButton({ ...params, ...navigationParams, ...screenProps })); } if (back) {