Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

In Android Modal - wrapping content in GestureHandlerRootView not fixing react-native-gesture-handler

Writer Matthew Harrington

I am using expo ^40.0.0.

I am trying to get react-native-gesture-handler components to work in a <Modal> from react-native in Android. I followed docs here -

It stays to wrap in <GestureHandlerRootView>, I did this but it doesn't fix the issue.

I created a snack demo of issue -

Here you see a "Tapped here count: 0". Please try tapping it, you will see it doesn't increment the counter.

You will see a "RN BUTTON" this works but it is not from react-native-gesture-handler.

Here is my code from the snack:

import * as React from 'react';
import { Text, View, Modal, Button as RNButton } from 'react-native';
import { BaseButton, GestureHandlerRootView
} from 'react-native-gesture-handler';
export default function App() { return ( <Modal animationType="slide" transparent={false}> <Example /> </Modal> );
}
const Example = function () { const [cnt, setCnt] = React.useState(0); return ( <View style={{ justifyContent: 'center', flex: 1 }}> <RNButton title="rn button" onPress={() => alert('hi')} /> <GestureHandlerRootView> <BaseButton onPress={() => { // alert('pressed'); setCnt(cnt + 1); }} > <View style={{ backgroundColor: 'steelblue', height: 100 }}> <Text>Tapped here count: {cnt}</Text> </View> </BaseButton> </GestureHandlerRootView> </View> );
};
3 Related questions 17 React Native 'Modal' Component Not Covering Entire Screen on Android when using Full Screen Theme 1 's from resizing automatically when inside a Modal?">React Native Android - how do i *stop* <View>'s from resizing automatically when inside a Modal? 2 react native modal not opening Related questions 17 React Native 'Modal' Component Not Covering Entire Screen on Android when using Full Screen Theme 1 's from resizing automatically when inside a Modal?">React Native Android - how do i *stop* <View>'s from resizing automatically when inside a Modal? 2 react native modal not opening 0 REACT Native Modal transparent prop is bugging on Android 4 react native gesture handler is not working with modal in Android 1 React native modal does not behave as expected 2 react native modal close with swipe down (react-native-swipe-gestures) 1 Swipe down modal only when at the top of FlatList 0 Modal blocks all press events on Android (React Native .66.4) 5 React native rerenders whole component on modal open/close Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.