CRASH with Swipeable when setting state on componentDidMount
See original GitHub issueArgument 1 (NSNumber) of RNGestureHandlerModule.attachGestureHandler must not be null
Gesture handler version: 1.0.1
I made a simple reproduction repo of the problem here: https://github.com/henrikra/gesture-handler-crash/blob/master/App.js
Steps to reproduce:
- Use
Swipeable
somewhere in your component - Use
setState
incomponentDidMount
- See crash! 💥
Workaround: Add setTimeout
with 0
delay and it will not crash. But this is very flake workaround and should not be used
I hope this gets fixed soon since this is very critical bug 😕
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:9 (6 by maintainers)
Top Results From Across the Web
CRASH with Swipeable when setting state on ... - GitHub
Use Swipeable somewhere in your component; Use setState in componentDidMount; See crash!. Workaround: Add setTimeout with 0 delay and ...
Read more >Setting state on componentDidMount() - reactjs - Stack Overflow
According to the React Documentation it's perfectly OK to call setState() from within the componentDidMount() function ...
Read more >Drawer Navigator | React Navigation
Whether the keyboard should be dismissed when the swipe gesture begins. Defaults to 'on-drag' . Set to 'none' to disable keyboard handling. unmountOnBlur...
Read more >React Lifecycle Methods Render And ComponentDidMount
componentDidMount () method is the perfect place, where we can call the setState() method to change the state of our application and render()...
Read more >How can I detect browser back button in react class component
react detect browser back button is clicked. onpopstate = e => { //your code } } 31 VirajReact redux: how to clear the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Still getting the same error
Hi there,
I encountered that error using a custom component as a child to
PanGestureHandler
that was usingView
but without passing thenativeProps
down.Adding :
to my component fixed it.
Hopefully it can help other devs looking at that issue to figure out what their problem is 🙂