Nurdin
Nurdin

Reputation: 23893

React native - navigation.navigate is not a function

I got this yellow warning message when trying to navigate the through pages.

navigation.navigate is not a function

My code

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

This solution not really helping - navigation.navigate is not a function.

Reference: https://github.com/datomnurdin/auth-reactnative

Upvotes: 1

Views: 3761

Answers (1)

Roi
Roi

Reputation: 1003

Have you tried to add curly braces around the navigation

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

Upvotes: 6

Related Questions