爲什麼我在React Native Navigator組件中收到route
爲undefined
的錯誤?我以爲我在推動正確的信息,但我猜不是嗎?任何幫助,將不勝感激。我習慣於使用網絡,所以React Native就是一個轉變。React Native Navigator路由對象未定義
所以......
我想從我的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)
則...
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}
/>
)
}
}
路線是'undefined'兩種方式。 – maxwellgover