我在我的react-navigation
应用程序中使用react-native
v3。
我有一个不同屏幕的stackNavigator
const CarsListStack = createStackNavigator({
CarsListScreen: { screen: CarsListScreen },
FiltersScreen: { screen: FiltersScreen },
CardDetailScreen: { screen: CardDetailScreen },
},
{
initialRouteName: 'CarsListScreen',
});
我知道在mode: 'modal
选项中添加:createStackNavigator
会使堆栈中的所有屏幕从底部打开。
我怎样才能让CardDetailScreen
从底部打开并像往常一样打开堆叠中的其他屏幕?
你需要为CardDetailScreen
制作另一个堆栈,所以;
// Main Card-Style Navigator
const MainStack = createStackNavigator({
CarsListScreen: { screen: CarListScreen },
FiltersScreen: { screen: FiltersScreen },
CardDetailScreen: { screen: ModalStack },
},
{
initialRouteName:'CarsListScreen'
});
// Modal-Style Navigator
const ModalStack = StackNavigator({
Home: { screen: MainStack },
Modal: { screen: CarDetailScreen },
}, {
mode: 'modal',
headerMode:'none',
});