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

Why index in the Portal key? #25

Open
ironchestgames opened this issue Jul 7, 2022 · 0 comments
Open

Why index in the Portal key? #25

ironchestgames opened this issue Jul 7, 2022 · 0 comments

Comments

@ironchestgames
Copy link

Hi, we were having some problems in our app with components being unmounted in an unpredictable way. We traced it back to this line below.

Let's say a portal was unmounted, doesn't having the index in the key ensures that those Portals in the list after the unmounted one rerenders because of the new key, but the ones in the beginning of the list will not? (since their key will be the same due to being at the same index as before)

react-native-portalize-jibberishkey000-0
react-native-portalize-jibberishkey111-1
react-native-portalize-jibberishkey222-2

unmount react-native-portalize-jibberishkey111-1

react-native-portalize-jibberishkey000-0 <- same key
react-native-portalize-jibberishkey222-1 <- new key

key={`react-native-portalize-${key}-${index}`}

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

No branches or pull requests

1 participant