diff --git a/README.md b/README.md index 9eb28a2f9..c9d22e1f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# React Native Router [![Join the chat at https://gitter.im/aksonov/react-native-router-flux](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aksonov/react-native-router-flux?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Codacy Badge](https://api.codacy.com/project/badge/grade/c6d869e2367a4fb491efc9de228c5ac6)](https://www.codacy.com/app/aksonov-github/react-native-router-flux) [![npm version](https://badge.fury.io/js/react-native-router-flux.svg)](http://badge.fury.io/js/react-native-router-flux) [![CircleCI](https://circleci.com/gh/aksonov/react-native-router-flux.svg?style=svg)](https://circleci.com/gh/aksonov/react-native-router-flux) +# React Native Router [![Join the chat at https://gitter.im/aksonov/react-native-router-flux](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aksonov/react-native-router-flux?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Codacy Badge](https://api.codacy.com/project/badge/grade/c6d869e2367a4fb491efc9de228c5ac6)](https://www.codacy.com/app/aksonov-github/react-native-router-flux) [![npm version](https://badge.fury.io/js/react-native-router-flux.svg)](http://badge.fury.io/js/react-native-router-flux) [![CircleCI](https://circleci.com/gh/EdtechFoundry/react-native-router-flux.svg?style=svg&circle-token=9b5d3dcef6c6e9cca4af163fba0e1fbf3e8620ae)](https://circleci.com/gh/EdtechFoundry/react-native-router-flux) -[![NPM](https://nodei.co/npm/react-native-router-flux.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/react-native-router-flux/) +[![NPM](https://nodei.co/npm/react-native-router-flux.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/react-native-router-flux/) Router for React Native based on new React Native Navigation API. Please check latest 4.0.0-beta.* , Example as demo: diff --git a/docs/API_CONFIGURATION.md b/docs/API_CONFIGURATION.md index 69d0d9516..bf90de2b0 100644 --- a/docs/API_CONFIGURATION.md +++ b/docs/API_CONFIGURATION.md @@ -22,7 +22,7 @@ | children | | required (if no scenes property passed)| Scene root element | | scenes | `object` | optional | scenes for Router created with Actions.create. This will allow to create all actions BEFORE React processing. If you don't need it you may pass Scene root element as children | | getSceneStyle | `function` | optional | Optionally override the styles for NavigationCard's Animated.View rendering the scene. | -| backAndroidHandler | `function` | optional | Optionally override the handler for `BackAndroid`, return `true` to stay in the app or return `false` to exit the app. Default handler will pop a scene and exit the app at last when the back key is pressed on Android. | +| backAndroidHandler | `function` | optional | Optionally override the handler for `BackHandler`, return `true` to stay in the app or return `false` to exit the app. Default handler will pop a scene and exit the app at last when the back key is pressed on Android. | | onBackAndroid | `function` | optional | Get called after back key is pressed and a scene is popped, won't affect the default behavior. | | onExitApp | `function` | optional | Optionally override the default action after back key is pressed on root scene. Return `true` to stay, or return `false` to exit the app. | diff --git a/package.json b/package.json index 47ffdf456..329c29f4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-router-flux", - "version": "3.41.0", + "version": "3.41.0-0", "description": "React Native Router using Flux architecture", "repository": { "type": "git", @@ -37,15 +37,19 @@ ], "dependencies": { "lodash.isequal": "^4.5.0", - "react-native-experimental-navigation": "^0.28.0", + "react-native-experimental-navigation": "https://github.com/EdtechFoundry/react-native-experimental-navigation.git#0.26.10-1.0.0", "react-native-tabs": "^1.0.9", "react-static-container": "^1.0.1" }, "devDependencies": { + "@edtechfoundry/react-native-mock": "^0.4.4", "babel-eslint": "^7.2.3", "babel-jest": "20.0.3", + "babel-jest": "19.0.0", + "babel-preset-es2015": "^6.22.0", "babel-preset-react-native": "2.0.0", "babel-preset-react-native-stage-0": "^1.0.1", + "babel-preset-stage-0": "^6.22.0", "chai": "^3.5.0", "eslint": "^3.1.1", "eslint-plugin-react": "^7.1.0", diff --git a/src/DefaultRenderer.js b/src/DefaultRenderer.js index 21cf5e162..4763df55c 100644 --- a/src/DefaultRenderer.js +++ b/src/DefaultRenderer.js @@ -8,8 +8,8 @@ */ import React, { PureComponent, - PropTypes, } from 'react'; +import PropTypes from 'prop-types'; import { Animated, View, @@ -339,7 +339,14 @@ export default class DefaultRenderer extends PureComponent { if (duration === 0) { pos.setValue(navState.index); } else { - Animated.timing(pos, { toValue: navState.index, duration }).start(); + Animated.timing( + pos, + { + toValue: navState.index, + useNativeDriver: true, + duration, + }, + ).start(); } }; } diff --git a/src/Modal.js b/src/Modal.js index a8c472067..6add9b2da 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -1,6 +1,4 @@ -import React, { - PropTypes, -} from 'react'; +import PropTypes from 'prop-types'; import { View, } from 'react-native'; diff --git a/src/NavBar.js b/src/NavBar.js index d9a2bb277..db4fdb021 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -23,9 +23,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -import React, { - PropTypes, -} from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { Platform, Animated, @@ -182,7 +181,6 @@ const propTypes = { getTitle: PropTypes.func, titleWrapperStyle: Text.propTypes.style, titleStyle: Text.propTypes.style, - titleOpacity: PropTypes.number, titleProps: PropTypes.any, position: PropTypes.object, navigationBarStyle: ViewPropTypes.style, @@ -202,7 +200,6 @@ const contextTypes = { const defaultProps = { drawerImage: _drawerImage, backButtonImage: _backButtonImage, - titleOpacity: 1, }; class NavBar extends React.Component { @@ -243,6 +240,7 @@ class NavBar extends React.Component { return ( @@ -315,6 +314,7 @@ class NavBar extends React.Component { {...state} key={'rightNavBarBtn'} testID="rightNavButton" + accessibilityLabel={self.props.rightAccessibilityLabel} style={style} textButtonStyle={textStyle} /> @@ -342,6 +342,7 @@ class NavBar extends React.Component { @@ -474,6 +475,7 @@ class NavBar extends React.Component { > diff --git a/src/Router.js b/src/Router.js index f729462e6..539855ce6 100644 --- a/src/Router.js +++ b/src/Router.js @@ -8,8 +8,8 @@ */ import React, { Component, - PropTypes, } from 'react'; +import PropTypes from 'prop-types'; import { BackHandler } from 'react-native'; import NavigationExperimental from 'react-native-experimental-navigation'; diff --git a/src/Scene.js b/src/Scene.js index daf1bcb64..229c4e03d 100644 --- a/src/Scene.js +++ b/src/Scene.js @@ -6,7 +6,8 @@ * LICENSE file in the root directory of this source tree. * */ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { ViewPropTypes, Text } from 'react-native'; export default class extends React.Component { diff --git a/src/Switch.js b/src/Switch.js index 0c4716621..0b37961ac 100644 --- a/src/Switch.js +++ b/src/Switch.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import TabBar from './TabBar'; import Actions from './Actions'; diff --git a/src/TabBar.js b/src/TabBar.js index f08952692..34e164f3d 100644 --- a/src/TabBar.js +++ b/src/TabBar.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import { Image, View, diff --git a/src/TabbedView.js b/src/TabbedView.js index 7071a7506..91bb8ab61 100644 --- a/src/TabbedView.js +++ b/src/TabbedView.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import { View, StyleSheet, ViewPropTypes } from 'react-native'; import StaticContainer from 'react-static-container';