Both of react-native
and react-native-gesture-handler
provide Touchables (TouchableOpacity
, TouchableHighlight
, etc).
What is the difference between the Touchables from both packages?
Any detailed explanation would be appreciated.
Both of react-native
and react-native-gesture-handler
provide Touchables (TouchableOpacity
, TouchableHighlight
, etc).
What is the difference between the Touchables from both packages?
Any detailed explanation would be appreciated.
In a practical egsample TouchableOpacity from RNGH can be used in loop and we will be able to identify each object in a loop uniquely(for eg:to get keyId of an element in a loop) but we use the other touchableOpacity from react-native this cant be done
I think the description on their docs is very useful:
https://docs.swmansion.com/react-native-gesture-handler/docs/component-touchables
So if you are on the native side (not web) it’s better to use Touchables from RNGH. Maybe they will include the new pressable component from RN soon.
Your answer let me to get rid of bugs with Flatlist and TouchableWithoutFeedback usage simultaneously. When I used TouchableWithoutFeedback with onLongPressed sometimes it did not detect long pressed. Then I changed import from react-native to RNGH and it is fixed. So I recommend using RNGH when you need to use TouchableWithoutFeedback inside a Flatlist in RN.