2016-11-14 7 views
1

これは私の最初のプロジェクトです。別の画面を開始しようとしました。このエラーが発生しました :未定義はオブジェクトではありません(評価 'this.props.navigator.push') なぜ私は反応ネイティブの経験がありませんかわかりません
これは私のコードです。アイディア !React Native、Android、UndefinedはTouchableHighlightのオブジェクトではありません(this.props.navigator.pushを評価しています)

class loginApp extends Component { 
    render() { 
     return (
      <View style={styles.container}> 
       <Text style={styles.title}> 
        Welcome Sign Up Here 
       </Text> 
       <View> 

        <TextInput 
         placeholder="Name" 
         style={styles.formInput} 
         /> 
        <TextInput 
         placeholder="Password" 
         secureTextEntry={true} 
         style={styles.formInput} 
         /> 
         <TextInput 
         placeholder="UserName" 
         style={styles.formInput} 
         /> 
          <TextInput 
         placeholder="Email" 
         style={styles.formInput} 
         /> 
        <TouchableHighlight onPress={this.onPress.bind(this)} style={styles.button}> 
         <Text style={styles.buttonText}>Submit</Text> 
        </TouchableHighlight>   
       </View> 
      </View> 
     ); 
    } 
    onPress() { 
    this.props.navigator.push({ 
    title: "Secure Page", 
    component: SecureView, 
    }); 
}; 
}; 
+0

これはhttp://stackoverflow.com/questions/39928565/this2-props-navigator-push-is-not-aのかのう重複しています-function/39958933?noredirect = 1#comment67436731_39958933 –

+0

いいえ、この他の場合はどうぞ! –

答えて

0

あなたpropsnavigatorオブジェクトが含まれていません。 loginAppのインスタンスを作成するときにnavigatorオブジェクトを供給していることを確認してください。あなたは次のコードでnavigatorに合格していることを確認することができます

class loginApp extends Component{ 

    constructor(props){ 
    super(props); 

    console.log(props.navigator) // <- this will print in console if you are passing a navigator object. 
    } 

    ... 
} 
+0

ありがとうございます:) –

関連する問題