react-native 解决navigationOptions中Button onPress调用this 的方法问题

在最外部声明:

let that;

在class内部:

constructor(props){
        super(props);
        that = this;
}

在const * = StackNavigation({})中:

navigationOptions:{
            headerTitle: (
                
                    123
                
            ),
            headerRight: (
                that.props.navigation.navigate('Msg')}
                >
                    
                
            ),
            headerLeft: (
                 that.props.navigation.navigate('Find')}
                >
                    
                
            ),

你可能感兴趣的:(react-native 解决navigationOptions中Button onPress调用this 的方法问题)