Hey everyone,
I would like to use the new Swipeable module that Brent wrote about in the Expo 22 release. That being said, I’m a bit confused on how to get started.
I know react-native-gesture-handler
is under the DangerZone, eg:
import { DangerZone } from expo
DangerZone.GestureHandler doesn’t have Swipeable under the API.
expo/native-component-list
has this line:
import Swipeable from 'react-native-gesture-handler/Swipeable'
but that didn’t work either.
https://github.com/expo/native-component-list/blob/8ece68e1d3bdef345b8639446a9323172d82433e/screens/GestureHandler/AppleStyleSwipeableRow.js#L5
Any help would be appreciated!
Thanks!
After breaking apart GmailSwipeableRow, I’ve noticed that renderLeftActions
, renderRightActions
are the culprit to that error message. As soon as you remove them things work. I made renderRightAction
return and it still error’d out.
It looks like this was fixed in 1.0.0-alpha.29
:
https://github.com/kmagiera/react-native-gesture-handler/commit/6f8d12b8fdc6dc89c823d4812b5142aea9a67fcb
I’m going to try and copy over the file directly from the project and get it working!
Also, since we’re on the topic:
Is there any significance using DangerZone API over just importing the module directly like its happening here:
https://github.com/expo/native-component-list/blob/8ece68e1d3bdef345b8639446a9323172d82433e/screens/GestureHandlerSwipeableScreen.js#L4
Is the DangerZone Api more of a “it’s not our fault if it breaks” thing?
re: DangerZone.
It means two things: (1) This is new and less stable (similar to beta in that way) but also, importantly, (2) this may be removed from Expo without much warning, so be aware of that.
Thanks for sharing your investigation into it!
Would you think I’m crazy if I said the error only occurs when Chrome debugger is enabled? Everything works fine otherwise.
I’ve got it working in production:
The GitHub repo you linked to has examples. They’re not directly copy-and-pastable but they communicate the concepts behind the API. You can use Expo.DangerZone.GestureHandler to get access to the react-native-gesture-handler exports.
Hey,
Thanks! I have it working in prod but not when chrome dev tools is open unfortunately.
See these docs:
https://github.com/expo/expo-docs/pull/180