react-native-portalize
react-native-portalize copied to clipboard
Why index in the Portal key?
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
https://github.com/jeremybarbet/react-native-portalize/blob/cf09c488b58b73c406571e9203f07cfc4af59de8/src/Manager.tsx#L40