react-native-gesture-handler: RectButton onPress does not work
Hi,
RectButton
’s onPress
doesn’t work. I’m using React Native 0.60.4 inside of a Styled Component:
export const Hour = styled(RectButton)`
background: #fff;
padding: 20px;
flex: 1;
opacity: ${props => (props.enabled ? 1 : 0.7)};
align-items: center;
margin: 0 10px 20px;
`
I’ve tried running jestify
, a manual React Native link despite the recommendations, cleaning cache but nothing works. It decided not to work for NOTHING.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 20 (1 by maintainers)
Make sure you followed this insctructions
UPDATE 2022-08-17
Documentation changed and the installation is now more easier the ever. Take a look at the docs:
https://docs.swmansion.com/react-native-gesture-handler/docs/next/installation/#js
Resume:
install the lib
yarn add react-native-gesture-handler
After installation, wrap your entry point with
<GestureHandlerRootView>
orgestureHandlerRootHOC
export default function App() { return <GestureHandlerRootView style={{ flex: 1 }}>{/* content */}</GestureHandlerRootView>; }
you need adjust of this way, involving with GestureHandlerRootView
just add in your MainActivity.java
at the imports
and at the final
it’ll look like this
Be sure to follow complete setup steps for react-native-gesture-handler, including wrapping your root component in
<GestureHandlerRootView>
Thank you, its working now!! That’s what we got when do not read the docs rsrsrs