Reactjs 如何解决未定义的非对象的本机导航错误?

Reactjs 如何解决未定义的非对象的本机导航错误?,reactjs,react-native,react-navigation,Reactjs,React Native,React Navigation,这是我的密码。基于react navigation和navigators,我尝试了许多不同的方法,但仍然无法定义(评估_this3.props.navigation.navigate) 我甚至尝试重新启动包管理器并再次运行项目。 我正在安卓设备上运行我的项目 请帮助我输入代码的相关行 import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, Vie

这是我的密码。基于react navigation和navigators,我尝试了许多不同的方法,但仍然无法定义(评估_this3.props.navigation.navigate)

我甚至尝试重新启动包管理器并再次运行项目。 我正在安卓设备上运行我的项目

请帮助我输入代码的相关行

    import React, { 
   Component 
} from 'react';

import {
   AppRegistry,
   StyleSheet,
   Text,
   View,
   Image,
   Button,
   Alert,
} from 'react-native';

import { 
   StackNavigator, 
} from 'react-navigation';

import ProfileScreen from './ProfileScreen'
//import HomeScreen from './HomeScreen'


export const AwesomeProject = StackNavigator({ 
   //Home: {screen: HomeScreen}, 
   Profile: {
      screen: ProfileScreen,
      navigationOptions : { 
      title: 'Welcome', 
      }
   }, 
});

const onButtonPress = () => { 
   Alert.alert('Button has been pressed!'); 
};


class Blink extends Component {

   constructor(props) {
       super(props);
       this.state = {
         showText: true
      };

      // Toggle the state every second
       setInterval(() => {
         this.setState({ 
               showText: !this.state.showText 
         });
       }, 1000);
   }

   render() {
      let display = this.state.showText ? this.props.text : ' ';
      return (
            <Text> {display} </Text>
      );
   }
}


export default class HomeScreen extends Component {

   constructor(props){
      super(props)
   }

   render() {

      //const {navigate} = this.props.navigation;

      return (

            <View style={styles.container}>

               <Text style={styles.welcome}>
                     <Blink text='Hello!'/>
               </Text>

               <Button
                  //onPress = {onButtonPress} 
                  onPress = {() => this.props.navigation.navigate('Profile').bind(this)} 
                  title="Lets Go!" 
                  color="#851884" 
                  accessibilityLabel="Learn more about people">
               </Button>

            </View>
      );
   }
}

const styles = StyleSheet.create({

   container: {
       flex: 1,
       justifyContent: 'center',
       alignItems: 'center',
       backgroundColor: '#456987',
   },

   welcome: {
       fontSize: 20,
       textAlign: 'center',
       color: '#DD5522',
       margin: 10,
   },

});
import-React,{
组成部分
}从"反应",;
进口{
评估学,
样式表,
文本,
看法
形象,,
按钮
警觉的,
}从“反应本机”;
导入{
StackNavigator,
}从“反应导航”;
从“./ProfileScreen”导入ProfileScreen
//从“./主屏幕”导入主屏幕
导出常量AwesomeProject=StackNavigator({
//主屏幕:{屏幕:主屏幕},
简介:{
屏幕:ProfileScreen,
导航选项:{
标题:"欢迎",,
}
}, 
});
const onButtonPress=()=>{
警报。警报('按钮已按下!');
};
类扩展组件{
建造师(道具){
超级(道具);
此.state={
showText:true
};
//每秒钟切换一次状态
设置间隔(()=>{
这个.setState({
showText:!this.state.showText
});
}, 1000);
}
render(){
let display=this.state.showText?this.props.text:“”;
返回(
{display}
);
}
}
导出默认类主屏幕扩展组件{
建造师(道具){
超级(道具)
}
render(){
//const{navigate}=this.props.navigation;
返回(
this.props.navigation.navigate('Profile').bind(this)}
title=“我们走!”
color=“#851884”
accessibilityLabel=“了解更多关于人的信息”>
);
}
}
const styles=StyleSheet.create({
容器:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“#456987”,
},
欢迎:{
尺寸:20,
textAlign:'中心',
颜色:“#DD5522”,
差额:10,
},
});

检查此项:谢谢,但问题仍然存在请检查您的“StackNavigator”,似乎有误。