React native 在另一个视图中使用时,反应导航StackNavigator不出现
我试图使用React Navigation StackNavigator来处理一个流程,该流程在页面顶部包含一个静态组件,在底部包含不同的组件。我使用的代码是:React native 在另一个视图中使用时,反应导航StackNavigator不出现,react-native,react-navigation,React Native,React Navigation,我试图使用React Navigation StackNavigator来处理一个流程,该流程在页面顶部包含一个静态组件,在底部包含不同的组件。我使用的代码是: const Navigator = StackNavigator ({ splash: Splash, prompt: Prompt, pinCheck: PinCheck }, { initialRouteName: 'splash' }); export default cl
const Navigator = StackNavigator ({
splash: Splash,
prompt: Prompt,
pinCheck: PinCheck
}, {
initialRouteName: 'splash'
});
export default class Login extends React.Component
{
constructor (props)
{
super (props);
// code to set up animation state
}
componentDidMount()
{
// code to set up animation
}
finish_ (state)
{
this.props.navigation.navigate ('main', state);
}
render()
{
const screen = Dimensions.get('screen');
return (
<KeyboardAvoidingView style={Global.styles.verticalFill} ref={this.saveContainerRef}>
<ScrollView style={{flex: 1}} contentContainerStyle={{justifyContent: 'space-between'}}>
<Animated.View style={{opacity:this.state.fade1,alignItems:'center'}} >
<Image
style={{width:screen.width * 0.6,height: screen.height*0.55}}
source={imgLogo}
resizeMode='contain'
/>
<Navigator />
</Animated.View>
</ScrollView>
</KeyboardAvoidingView>
);
}
}
const Navigator=StackNavigator({
飞溅:飞溅,
提示:提示,
平切克:平切克
}, {
initialRouteName:“飞溅”
});
导出默认类登录扩展React.Component
{
建造师(道具)
{
超级(道具);
//设置动画状态的代码
}
componentDidMount()
{
//设置动画的代码
}
完成(状态)
{
this.props.navigation.navigate('main',状态);
}
render()
{
const screen=Dimensions.get('screen');
返回(
);
}
}
但是,当我运行此命令时,我的初始路由组件不会显示。但是,如果我将
交换为
,它会正常工作,因此组件本身肯定会在这种情况下工作
有什么问题吗?导航设置有问题
StackNavigator
中的所有路由都必须声明一个屏幕
如报告中所述
const Navigator = StackNavigator ({
splash: {
screen: splash
},
prompt: {
screen: prompt
},
pinCheck: {
screen: pinCheck
}
}, {
initialRouteName: 'splash'
})