である私が反応し、ネイティブでPOCアプリケーションを構築し、私は触れるハイライトをクリックしていたときに今すぐ反応し、ナビゲーションを反応ナビゲーションを働いていない、小道具は未定義
import {StackNavigator, DrawerNavigator} from 'react-navigation';
export default class HomeScreen extends React.Component {
constructor(props) {
super(props)
this.clicked = this.clicked.bind(this)
}
static navigationOptions = {
drawerLabel: 'Home',
};
clicked =()=> {
this.props.navigator.navigate('DrawerOpen'); // open drawer
}
render() {
// const {navigate} = this.props.navigation;
return (
<ScrollView>
<View style={styles.container}>
<View style={styles.header}>
<View style={{width: 50}}>
<TouchableHighlight onPress={()=> {
this.clicked("DrawerOpen")
}}>
<Image source={require('./img/hamburger_icon.png')}/>
</TouchableHighlight>
</View>
</View>
</View>
</ScrollView >
)
}
}
を実装しようとしています、関数が呼び出されますクリックすると、それがエラーを示しています
undefined is not an object (evaluating '_this.props.navigator.navigate')
clicked
それはまだ未定義 を示している。これは、動作していない(「_this.props.navigation.navigate」を評価)オブジェクト –