反应本机-navigation.navigate不是函数

时间:2018-12-24 10:24:57

标签: javascript reactjs react-native

当尝试浏览整个页面时,我得到了这个黄色警告消息。

navigation.navigate is not a function

我的代码

export default (navigation) => (
  <View>
    <Card>
      <Button
        onPress={() => {
          onSignIn().then(() => navigation.navigate("SignedIn")); //yellow warning message
        }}
      />
    </Card>
  </View>
);

此解决方案没有帮助-navigation.navigate is not a function

参考:https://github.com/datomnurdin/auth-reactnative

1 个答案:

答案 0 :(得分:2)

您是否尝试过在navigation周围加上花括号

export default ({navigation}) => (
  <View>
    <Card>
      <Button
        onPress={() => {
          onSignIn().then(() => navigation.navigate("SignedIn")); //yellow warning message
        }}
      />
    </Card>
  </View>
);