24 lines
454 B
TypeScript
24 lines
454 B
TypeScript
import { NavigationActions } from 'react-navigation';
|
|
|
|
let _navigator;
|
|
|
|
function setTopLevelNavigator(navigatorRef) {
|
|
_navigator = navigatorRef;
|
|
}
|
|
|
|
function navigate(routeName: string, params?: any) {
|
|
_navigator.dispatch(
|
|
NavigationActions.navigate({
|
|
routeName,
|
|
params
|
|
})
|
|
);
|
|
}
|
|
|
|
// add other navigation functions that you need and export them
|
|
|
|
export default {
|
|
navigate,
|
|
setTopLevelNavigator
|
|
};
|