Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to dynamically disable gestureEnabled in React Navigation?

$
0
0

I'm currently using React Navigation 5.x and I have a modal that swipes downward to close and it has ScrollView on it. The problem is, since the content can be scrolled by gesturing downward, the modal is sometimes accidentally closed. So I want to dynamically disable gestureEnabled to false until onScrollToTop indicates that the ScrollView has reached the top.

<Main.Navigator
    tabBarPosition="none"
    initialRouteName="Main"
    screenOptions={{
        headerShown: false,
        gestureEnabled: true,
        gestureResponseDistance: {
            horizontal: width,
            vertical: height,
        },
    }}
    mode="modal"
    headerMode="none">
 // screens
</Main.Navigator>

How do I pass props to screenOptions to disable gestureEnabled dynamically? Or is there a better way of resolving this?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>