- Install package:
yarn add react-navigation-extension
- Set navigator
import { setNavigatior } from 'react-navigation-extension';
<Navigator ref={(ref) => { setNavigatior('MAIN_NAVIGATOR', ref); }} />
- Make navigation
export const mainNavigation = makeNavigation('MAIN_NAVIGATOR');
- Navigate simple
import { mainNavigation } from 'react-navigation-extension';
mainNavigation.navigate('SIGN_UP');
mainNavigation.reset('SIGN_IN', 'FORGOT_PASSWORD', { email: '[email protected]' });
export const makeNavigation = (navigationRouteName: string) => ({
navigate: (routeName: string, params?: Object): boolean => {},
setParams: (params: NavigationParams): boolean => {},
goBack: () => {},
reset: (routeName?: string | string[], params?: Object) => {},
getCanNavigateBack: () => {},
});