Skip to content

Conversation

@janicduplessis
Copy link
Contributor

Component.displayName can be undefined for release builds which means a bunch of components will fight for the undefined key. In my app it results in the Switch component rendering nothing (or probably just another component like ScrollView).

To fix this I use the component class as the key in a WeakMap instead. I also added a null check since some components are being removed from RN core like ToolbarAndroid so it makes memoizeWrap safe in those cases.

`Component.displayName` can be undefined for release builds which means a bunch of components will fight for the undefined key. In my app it results in the `Switch` component rendering nothing (or probably just another component like `ScrollView`). I also added a null check since some components are being removed from RN core like ToolbarAndroid so it makes `memoizeWrap` safe in those cases.
Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @janicduplessis 🙌

@kmagiera kmagiera merged commit 28b7093 into software-mansion:master Aug 23, 2019
janicduplessis added a commit to janicduplessis/react-native-gesture-handler that referenced this pull request Feb 16, 2020
`Component.displayName` can be undefined for release builds which means a bunch of components will fight for the undefined key. In my app it results in the `Switch` component rendering nothing (or probably just another component like `ScrollView`). I also added a null check since some components are being removed from RN core like ToolbarAndroid so it makes `memoizeWrap` safe in those cases.
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

Successfully merging this pull request may close these issues.

2 participants