简体   繁体   English

undefined不是对象(评估this.props.navigation)

[英]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.

相关问题 未定义不是对象(评估“ this.props.navigation”) - undefined is not an object (evaluating 'this.props.navigation") 未定义不是对象(评估“ this.props.navigation”) - undefined is not an object (evaluating 'this.props.navigation') 未定义不是对象(评估“ this.props.navigation”) - undefined is not an object (evaluating “this.props.navigation”) undefined 不是带有 fetch 的 object(评估“this.props.navigation”) - undefined is not an object (evaluating 'this.props.navigation') with fetch undefined 不是一个对象(评估&#39;this.props.navigation&#39;)-React Native - undefined is not an object (evaluating 'this.props.navigation') - React Native TypeError:undefined 不是 React Native 中的对象(评估“_this.props.navigation”) - TypeError: undefined is not an object (evaluating '_this.props.navigation') in React Native 如何修复“未定义不是 object(评估 'this.props.navigation')” - How to fix “undefined is not an object (evaluating 'this.props.navigation')” undefined不是评估_this.props.navigation React Native的对象 - undefined is not an object evaluating _this.props.navigation React Native 未定义不是对象(评估&#39;_this.props.navigation&#39;) - Undifined is not an object(evaluating '_this.props.navigation') 如何解决React Native中的导航问题(TypeError:undefined不是一个对象(评估&#39;_this.props.navigation)) - How to fix navigation problem in React Native (TypeError: undefined is not an object (evaluating '_this.props.navigation)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM