Compare commits

..

2 Commits
2.2.3 ... 2.2.4

Author SHA1 Message Date
Brent Vatne
7345634493 Release 2.2.4 2018-06-07 11:33:14 -07:00
Brent Vatne
6517169119 Re-compute options when screenProps change 2018-06-07 11:31:31 -07:00
2 changed files with 16 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-navigation", "name": "react-navigation",
"version": "2.2.3", "version": "2.2.4",
"description": "Routing and navigation for your React Native apps", "description": "Routing and navigation for your React Native apps",
"main": "src/react-navigation.js", "main": "src/react-navigation.js",
"repository": { "repository": {

View File

@@ -8,10 +8,15 @@ function createNavigator(NavigatorView, router, navigationConfig) {
static router = router; static router = router;
static navigationOptions = null; static navigationOptions = null;
state = { constructor(props) {
descriptors: {}, super(props);
childEventSubscribers: {},
}; this.state = {
descriptors: {},
childEventSubscribers: {},
screenProps: props.screenProps,
};
}
static getDerivedStateFromProps(nextProps, prevState) { static getDerivedStateFromProps(nextProps, prevState) {
const { navigation, screenProps } = nextProps; const { navigation, screenProps } = nextProps;
@@ -21,7 +26,11 @@ function createNavigator(NavigatorView, router, navigationConfig) {
const descriptors = { ...prevState.descriptors }; const descriptors = { ...prevState.descriptors };
const childEventSubscribers = { ...prevState.childEventSubscribers }; const childEventSubscribers = { ...prevState.childEventSubscribers };
routes.forEach(route => { routes.forEach(route => {
if (!descriptors[route.key] || descriptors[route.key].state !== route) { if (
!descriptors[route.key] ||
descriptors[route.key].state !== route ||
screenProps !== prevState.screenProps
) {
const getComponent = () => const getComponent = () =>
router.getComponentForRouteName(route.routeName); router.getComponentForRouteName(route.routeName);
@@ -75,6 +84,7 @@ function createNavigator(NavigatorView, router, navigationConfig) {
return { return {
descriptors, descriptors,
childEventSubscribers, childEventSubscribers,
screenProps,
}; };
} }