内部からのネイティブアクセスthis.propに反応: "たonPress" は "this.about" 呼び出したときには、私は次のコードを持っている機能
"undefined is not an object ("evaluating this.props.nav")
:
module.exports = class Menu extends Component {
about() {
this.props.nav.push({
component: TestView,
title: 'Test View',
});
}
render() {
return (
<ScrollView
scrollsToTop={false}
style={styles.menu}
navigator={this.props.nav}>
<View style={styles.logoContainer}>
<Image
style={styles.logo}
source={{ uri, }}/>
</View>
<Text onPress={this.about} style={styles.item}>About</Text>
<Text style={styles.item}>Account</Text>
</ScrollView>
);
}
};
を、私は、エラーメッセージが出続けます。私はrender関数内にconsole.logを置いて、this.props.navに値が入っていることが分かりました。この問題はabout()関数で発生し、なぜその理由がわかりません。
どのような提案が素晴らしいでしょうか?
おかげ