1
我是新的反應原生,我試圖使用StackNavigator,但它不工作 我想打電話給一個組件並在你點擊一個按鈕時呈現它。 但我發現了這個錯誤: undefined is not an object (evaluating '_this2.props.navigation.navigate')
反應原生:undefined不是一個對象(評估'_this2.props.navigation.navigate')
這是我的主要成分:
export default class Home extends Component<{}> {
constructor(props) {
super(props);
this.email = null;
this.amount = null;
this.device = null;
}
render() {
return (
<ScrollView style={styles.styleSV}>
<Text
style={styles.styleLogin}>
Login
</Text>
<View style={styles.styleForm}/>
<TextInput placeholder='email' onChangeText={(text) => this.email }/>
<TextInput placeholder='amount' onChangeText={(text) => this.amount }/>
<TextInput placeholder='device' onChangeText={(text) => this.device }/>
<View style={styles.styleButtonSignup}/>
<Button
onPress={() =>
this.props.navigation.navigate('PaypalPayment', { email: this.email })
}
title='Next'
/>
</ScrollView>
);
}
}
const NavigationScreen = StackNavigator({
PaypalPayment: { screen: PaypalPayment },
Home: { screen: Home}
});
AppRegistry.registerComponent('paypal',() => NavigationScreen);
檢查的package.json和給我反應過來,導航版,在那之後我會幫你的。 –
「react-navigation」:「^ 1.0.0-beta.13」 –
您確定您沒有在其他地方呈現「PaypalPayment」或「Home」嗎? –