我想将整个屏幕从“摄像头”屏幕导航到“摘要”屏幕,但是它不起作用:
// 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('Summary')
替换为this.props.navigation.navigate('Home')
时,它会起作用。
这是主屏幕导航器:
const HomeStack = createStackNavigator({
Home: HomeScreen
});
const ScanStack = createStackNavigator({
Camera: CameraScreen
});
export default createBottomTabNavigator({
HomeStack,
CameraStack
});
答案 0 :(得分:0)
要使其工作,请将SummaryStack添加到您的主堆栈中
const HomeStack = createStackNavigator({
Home: HomeScreen,
Summary: SummaryStack
});