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",
"version": "2.2.3",
"version": "2.2.4",
"description": "Routing and navigation for your React Native apps",
"main": "src/react-navigation.js",
"repository": {

View File

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