我是根据https://reactnavigation.org/docs/en/navigating-without-navigation-prop.html文档中的信息提供的顶级导航服务
导航正常,但不发送婴儿车
import { NavigationActions } from 'react-navigation';
let _navigator;
function setTopLevelNavigator(navigatorRef) {
_navigator = navigatorRef;
}
function navigate(routeName, params, action) {
_navigator.dispatch(
NavigationActions.navigate({
routeName: routeName,
params: params,
action: action,
})
);
}
// add other navigation functions that you need and export them
export default {
navigate,
setTopLevelNavigator,
};
当我调用此函数时,它可以导航,但婴儿车无法识别
return NavigationService.navigate('Profile', { userName: 'TEST' })
也在尝试
return NavigationService.navigate('Customer', { promo: 'TEST' },
NavigationActions.navigate({ routeName: 'Coupons', params: { promo: 'TEST02' }, }))