2019-03-12 16:23:06 +00:00
|
|
|
import { NavigationActions } from 'react-navigation';
|
2019-01-31 16:08:38 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
let _navigator;
|
2019-01-31 16:08:38 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
function setTopLevelNavigator(navigatorRef) {
|
|
|
|
_navigator = navigatorRef;
|
|
|
|
}
|
2019-01-31 16:08:38 +00:00
|
|
|
|
2020-02-19 19:43:47 +00:00
|
|
|
function back() {
|
|
|
|
_navigator.dispatch(
|
|
|
|
NavigationActions.back()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
function navigate(routeName, params) {
|
|
|
|
_navigator.dispatch(
|
|
|
|
NavigationActions.navigate({
|
|
|
|
routeName,
|
|
|
|
params
|
|
|
|
})
|
|
|
|
);
|
2019-01-31 16:08:38 +00:00
|
|
|
}
|
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
export default {
|
2020-02-19 19:43:47 +00:00
|
|
|
back,
|
2019-03-12 16:23:06 +00:00
|
|
|
navigate,
|
|
|
|
setTopLevelNavigator
|
|
|
|
};
|