来自堆栈导航器的模态?

时间:2018-10-18 00:55:35

标签: react-native react-navigation

我正在尝试从常规stackNav启动模式。任何帮助都非常感谢。

我需要以AddBook的模式启动BooksList。这是我的堆栈设置:

const BookModalsNavigator = createStackNavigator({
    AddBook: AddBook,
}, {
    mode: 'modal',
}); 

const MyBooksNavigator = createStackNavigator({
    BooksList: BooksList,
    ViewBook: ViewBook,
    BookModalsNavigator: BookModalsNavigator,
});

然后我用以下方式调用模态:

this.props.navigation.navigate('AddBook')

并得到这个:(

enter image description here

1 个答案:

答案 0 :(得分:0)

如果有人碰到这个..我基本上倒过来了。您必须通过模态堆栈构建路径。解决方法:

const MyBooksNavigator = createStackNavigator({
    BooksList: BooksList,
    ViewBook: ViewBook,
});

const BookModalsNavigator = createStackNavigator({
    MyBooksNavigator: MyBooksNavigator,
    AddBook: AddBook,
}, {
    mode: 'modal',
    headerMode: 'none',
});

const AppNavigator = createBottomTabNavigator({
    MyBooks: BookModalsNavigator,
    Capture: Capture,
    More: MoreNavigator,
},