mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 09:08:15 +00:00
Navigation Action Helpers at root (#4151)
This commit is contained in:
parent
2fd7284fe2
commit
364144d639
@ -5,6 +5,7 @@ import { polyfill } from 'react-lifecycles-compat';
|
|||||||
import { BackHandler } from './PlatformHelpers';
|
import { BackHandler } from './PlatformHelpers';
|
||||||
import NavigationActions from './NavigationActions';
|
import NavigationActions from './NavigationActions';
|
||||||
import invariant from './utils/invariant';
|
import invariant from './utils/invariant';
|
||||||
|
import getNavigationActionCreators from './routers/getNavigationActionCreators';
|
||||||
import docsUrl from './utils/docsUrl';
|
import docsUrl from './utils/docsUrl';
|
||||||
|
|
||||||
function isStateful(props) {
|
function isStateful(props) {
|
||||||
@ -359,6 +360,11 @@ export default function createNavigationContainer(Component) {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
const actionCreators = getNavigationActionCreators(nav);
|
||||||
|
Object.keys(actionCreators).forEach(actionName => {
|
||||||
|
this._navigation[actionName] = (...args) =>
|
||||||
|
this.dispatch(actionCreators[actionName](...args));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
navigation = this._navigation;
|
navigation = this._navigation;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
|
|
||||||
getActionCreators(route, navStateKey) {
|
getActionCreators(route, navStateKey) {
|
||||||
return {
|
return {
|
||||||
...getNavigationActionCreators(route, navStateKey),
|
...getNavigationActionCreators(route),
|
||||||
...getCustomActionCreators(route, navStateKey),
|
...getCustomActionCreators(route, navStateKey),
|
||||||
pop: (n, params) =>
|
pop: (n, params) =>
|
||||||
StackActions.pop({
|
StackActions.pop({
|
||||||
|
@ -108,7 +108,7 @@ export default (routeConfigs, config = {}) => {
|
|||||||
|
|
||||||
getActionCreators(route, stateKey) {
|
getActionCreators(route, stateKey) {
|
||||||
return {
|
return {
|
||||||
...getNavigationActionCreators(route, stateKey),
|
...getNavigationActionCreators(route),
|
||||||
...getCustomActionCreators(route, stateKey),
|
...getCustomActionCreators(route, stateKey),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user