React Native: Pressable Not Working in Modal (Quick Fix)
Problem:
Pressable(or gesture components) inside aModaldon’t respond to taps.- Happens with
react-native-gesture-handler.
Why:
Modalrenders outside the normal view tree, so gestures break unless wrapped inGestureHandlerRootView.
Fix:
import { GestureHandlerRootView } from "react-native-gesture-handler";
<Modal transparent>
<GestureHandlerRootView style={{ flex: 1 }}>
<Pressable onPress={onClose}>
<Text>Close</Text>
</Pressable>
</GestureHandlerRootView>
</Modal>;
style={{ flex: 1 }}is required so gestures work everywhere in the modal.
Rule:
- Always wrap modal content with
GestureHandlerRootViewif using gesture components inside aModal.