[英]undefined is not an object (Evaluating this.props.navigation)
I'm trying to keep touchable opacity at top right in navigation bar, For onPress of touchable opacity. 我正在尝试在导航栏中的右上角保持可触摸的不透明度,以用于onPress的可触摸的不透明度。 I want to take the user to home page.
我想将用户带到主页。
constructor(props) {
super(props);
this.state = {
stAccntList: [],
stUserAccountNo: '',
stCustNo: '',
resp: '',
};
}
static navigationOptions = {
// title: 'myacc',
title: 'My Accounts',
headerRight: <TouchableHighlight onPress={() => {
this.props.navigation.navigate('home');
}}>
<Image style={{ marginRight: 20 }} source={require('../../../resources/toolbar/home_inactive.png')} />
</TouchableHighlight>,
headerTintColor: 'white',
headerStyle: {
backgroundColor: colors.themeColor,
// top: 30
}
}
It's throwing red screen with above error. 它抛出红色屏幕并出现上述错误。 Please let me know where I'm going wrong.
请让我知道我要去哪里了。
Try this it is work :) 试试这是工作:)
static navigationOptions = ({navigation}) => ({
title: 'My Accounts',
headerRight: <TouchableHighlight onPress={() => {
navigation.navigate('home');
}}>
<Image style={{ marginRight: 20, height: 30, width: 30 }}
source={{ uri:https://media.freepik.com/accounts/img/badges/downloads_gold.png'
}} />
</TouchableHighlight>,
headerTintColor: 'white',
headerStyle: {
backgroundColor: colors.themeColor,
// top: 30
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.