[英]undefined is not an object (evaluating 'this.props.navigation")
[英]undefined is not an object (Evaluating this.props.navigation)
我正在嘗試在導航欄中的右上角保持可觸摸的不透明度,以用於onPress的可觸摸的不透明度。 我想將用戶帶到主頁。
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
}
}
它拋出紅色屏幕並出現上述錯誤。 請讓我知道我要去哪里了。
試試這是工作:)
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.