为什么我的 stacknavigator 使用一个屏幕而不是另一个屏幕?

Why my stacknavigator works with one screen and not with another one?

我想跨屏幕从相机屏幕导航到摘要屏幕,但它不起作用:

        // Camera screen
        if (data.data){
            const data = {date,name,place}

           Alert.alert(
               'Info', 'Show', 
                [{text: 'More', onPress: () => this.props.navigation.navigate('Summary')}],          
               )
        })}

我已经定义了如下的堆栈导航器:

        //Navigator file
        import SummaryScreen from  '../screens/SummaryScreen';

         export const SummaryStack = createStackNavigator({
         Summary : SummaryScreen
         });

有趣的是,当我用 this.props.navigation.navigate('Home') 替换 this.props.navigation.navigate('Summary') 时,它起作用了。

这是主屏幕导航器:

const HomeStack = createStackNavigator({
Home: HomeScreen
});

const ScanStack = createStackNavigator({
Camera: CameraScreen
});

export default createBottomTabNavigator({
HomeStack,
CameraStack
});

要使其正常工作,请将 SummaryStack 添加到您的主堆栈

const HomeStack = createStackNavigator({
   Home: HomeScreen,
   Summary: SummaryStack
});