为什么我的 React Native Navigator 组件中route
出现错误?undefined
我以为我在推送正确的信息,但我猜不是?任何帮助,将不胜感激。我习惯于使用网络,所以 React Native 是一个很大的转变。
所以...
我想从我的SplashContainer
组件导航到我的SignUpForm
组件。所以在SplashContainer
我这样做...
class SplashContainer extends Component {
handleLoginFinished = () => {
this.props.dispatch(handleAuthWithFirebase())
}
handleToSignUp = () => {
this.props.navigator.push({
signUpForm: true
});
}
handleToSignIn = () => {
this.props.navigator.push({
signIn: true
})
}
render () {
return (
<Splash onLoginFinished={this.handleLoginFinished} goToSignUp={this.handleToSignUp} goToSignIn={this.handleToSignIn} />
)
}
}
export default connect()(SplashContainer)
然后在 React Native Navigator 中我这样做......
export default class NimbusNavigator extends Component {
static propTypes = {
isAuthed: PropTypes.bool.isRequired
}
renderScene = (route, navigator) => {
// Keeps track of whether user is Authed or not.
if (this.props.isAuthed === false) {
return <SplashContainer navigator={navigator}/>
} else if (route.signUpForm === true) {
return <SignUpForm navigator={navigator}/>
}
return <FooterTabsContainer navigator={navigator} />
}
configureScene = (route) => {
}
render () {
return (
<Navigator
configureScene={this.configureScene}
renderScene={this.renderScene}
/>
)
}
}