Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack.Screen props getId is called twice #9343

Closed
Daavidaviid opened this issue Feb 20, 2021 · 2 comments
Closed

Stack.Screen props getId is called twice #9343

Daavidaviid opened this issue Feb 20, 2021 · 2 comments

Comments

@Daavidaviid
Copy link

Daavidaviid commented Feb 20, 2021

Current Behavior

  • What code are you running and what is happening?

I have a Stack.Navigator with screens inside, when i try to use getId, the getId callback is called twice in a row.

<Stack.Screen
  getId={({ params }) => {
    console.log({ params });
    return params?.userId;
  }}
  name={'UserAchievements'}
  component={UserAchievements}
  />

This will print this after I call navigate or push to UserAchievements screen (only once, I checked) :

> {"params": {"userId": "SQZ5MB9y1qg0OwnTrpFeIyAJ8Hn2"}}
> {"params": undefined}

Expected Behavior

It should not be called twice and with undefined value the second time.

I don't know if it's a bug or an error from my part.

Your Environment

software version
iOS or Android
@react-navigation/native ^5.9.2
@react-navigation/stack ^5.14.2
react-native-gesture-handler ^1.10.1
react-native-safe-area-context ^3.1.9
react-native-screens ^2.17.1
react-native ^0.63.4
expo
node
npm or yarn yarn
@divyanaimisha
Copy link

This is still happening

@github-actions
Copy link

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants