Compare commits

...

5 Commits

Author SHA1 Message Date
Brent Vatne
3d7a62490c Release 2.18.1 2018-10-23 18:55:40 -07:00
Brent Vatne
445e4d95b8 Backport child navigation cache fix 2018-10-23 18:54:04 -07:00
Brent Vatne
9c12052199 Release 2.18.0 2018-10-11 13:54:18 -07:00
Brent Vatne
994c2c0828 Update react-navigation-tabs 2018-10-11 13:51:30 -07:00
Tien Pham
c27a197ddb Fix unexpected route switching after the transition is complete (#5113) 2018-10-11 13:51:24 -07:00
8 changed files with 1123 additions and 121 deletions

View File

@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
## [2.18.1] - [2018-10-23](https://github.com/react-navigation/react-navigation/releases/tag/2.18.1)
### Fixed
- Backport fix for child navigation object caching
## [2.18.0] - [2018-10-11](https://github.com/react-navigation/react-navigation/releases/tag/2.18.0)
### Added
- Introduce getActiveChildNavigationOptions (#5080)
### Changed
- Updated react-navigation-tabs to 0.8.4 to fix issue with Snack
- Flow changes:
- Update StackViewConfig to match recent changes (#5067)
- Mark key in StackActions.replace as optional (#5073)
- Remove drawer actions from react-navigation-web
- Add disableRouteNamePaths option to router configs (#4824)
## [2.17.0] - [2018-09-25](https://github.com/react-navigation/react-navigation/releases/tag/2.17.0)
### Changed
@@ -218,7 +239,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- Improved examples
[Unreleased]: https://github.com/react-navigation/react-navigation/compare/2.17.0...HEAD
[Unreleased]: https://github.com/react-navigation/react-navigation/compare/2.18.1...HEAD
[2.18.1]: https://github.com/react-navigation/react-navigation/compare/2.18.0...2.18.1
[2.18.0]: https://github.com/react-navigation/react-navigation/compare/2.17.0...2.18.0
[2.17.0]: https://github.com/react-navigation/react-navigation/compare/2.16.0...2.17.0
[2.16.0]: https://github.com/react-navigation/react-navigation/compare/2.15.0...2.16.0
[2.15.0]: https://github.com/react-navigation/react-navigation/compare/2.14.2...2.15.0

View File

@@ -5543,10 +5543,10 @@ react-navigation-stack@0.7.0:
resolved "https://registry.yarnpkg.com/react-navigation-stack/-/react-navigation-stack-0.7.0.tgz#0b2f139ee1cba953037ef51353df992ec6c74fa2"
integrity sha512-3Tbb/SsustBrM9R/qaI6XuOfyqYMVbwkeHFC8NbU890vB0aKZvjAtioWLZ18e/4LgbiOCmoTdp37z3gkGDyNDQ==
react-navigation-tabs@0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.8.2.tgz#65f8a6ce368684227603345b4d312da2ef3366e1"
integrity sha512-q2xfY79ERj4XJek3rceveifUny3Qcg7y6bNlN6wQg6c7D/pMFOGZsSALGenF7CuNDhYyEkijlnGTHl1laZgbDw==
react-navigation-tabs@0.8.4:
version "0.8.4"
resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.8.4.tgz#aa767f28b899f13c99f2b034b4a665f8cf0a5737"
integrity sha512-CbS3xIVJVtpu+AYslv0PMLmjddJFVtU3XAhSJ9XnMrKLUJNmnQdW/L0w/Gp5qcBEF9h6bgsY3CoTtp7I6bqyOQ==
dependencies:
hoist-non-react-statics "^2.5.0"
prop-types "^15.6.1"

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation",
"version": "2.17.0",
"version": "2.18.1",
"description": "Routing and navigation for your React Native apps",
"main": "src/react-navigation.js",
"repository": {
@@ -41,7 +41,7 @@
"react-navigation-deprecated-tab-navigator": "1.3.0",
"react-navigation-drawer": "0.5.0",
"react-navigation-stack": "0.7.0",
"react-navigation-tabs": "0.8.2"
"react-navigation-tabs": "0.8.4"
},
"devDependencies": {
"babel-cli": "^6.24.1",

View File

@@ -1,6 +1,7 @@
import getChildEventSubscriber from './getChildEventSubscriber';
import getChildRouter from './getChildRouter';
import getNavigationActionCreators from './routers/getNavigationActionCreators';
import getChildrenNavigationCache from './getChildrenNavigationCache';
import invariant from './utils/invariant';
const createParamGetter = route => (paramName, defaultValue) => {
@@ -14,8 +15,7 @@ const createParamGetter = route => (paramName, defaultValue) => {
};
function getChildNavigation(navigation, childKey, getCurrentParentNavigation) {
const children =
navigation._childrenNavigation || (navigation._childrenNavigation = {});
const children = getChildrenNavigationCache(navigation);
const childRoute = navigation.state.routes.find(r => r.key === childKey);

View File

@@ -0,0 +1,16 @@
export default function getChildrenNavigationCache(navigation) {
if (!navigation) {
return {};
}
let childrenNavigationCache =
navigation._childrenNavigation || (navigation._childrenNavigation = {});
let childKeys = navigation.state.routes.map(route => route.key);
Object.keys(childrenNavigationCache).forEach(cacheKey => {
if (!childKeys.includes(cacheKey)) {
delete childrenNavigationCache[cacheKey];
}
});
return navigation._childrenNavigation;
}

View File

@@ -1,5 +1,6 @@
import getNavigationActionCreators from './routers/getNavigationActionCreators';
import getChildNavigation from './getChildNavigation';
import getChildrenNavigationCache from './getChildrenNavigationCache';
export default function getNavigation(
router,
@@ -38,6 +39,7 @@ export default function getNavigation(
};
},
dangerouslyGetParent: () => null,
_childrenNavigation: getChildrenNavigationCache(getCurrentNavigation()),
};
const actionCreators = {

View File

@@ -543,8 +543,10 @@ export default (routeConfigs, stackConfig = {}) => {
state,
childRoute.key,
route,
// the following tells replaceAt to NOT change the index to this route for the setParam action, because people don't expect param-setting actions to switch the active route
action.type === NavigationActions.SET_PARAMS
// the following tells replaceAt to NOT change the index to this route for the setParam action or complete transition action,
// because people don't expect these actions to switch the active route
action.type === NavigationActions.SET_PARAMS ||
action.type === StackActions.COMPLETE_TRANSITION
);
}
}

1179
yarn.lock

File diff suppressed because it is too large Load Diff