Tell us which versions you are using:
There should have an easy option to disable swipe down gesture.
In a modal that has multiple pages, when you swipe left to go to previous one, sometimes the modal will close. It will only work if you swipe perfectly in horizontal. If you go down just a little bit, the swipe left gesture will be aborted.
<Scene key="myModal" direction="vertical">
<Scene key="modalPage1" component={Page1WithListView}/>
<Scene key="modalPage2" component={Page2}/>
</Scene>
I'm having this issue as well, but with a Webview
@brunolemos This moment has been observed for a long time.
I use the following decision:
const getSceneStyle = (props, computedProps) => {
const preVerticalDirection = props.scenes[1] ? props.scenes[1].navigationState.direction === "vertical" : null;
const idx = props.scene.index;
const {direction} = props.scene.navigationState;
const inputRange = [idx - 1, idx, idx + 1];
const style = {
flex: 1,
backgroundColor: 'white',
};
if (direction == 'vertical') {
const translateY = props.position.interpolate({
inputRange,
outputRange: [SceneHeight, 0, 0],
});
style.transform = [
{ scale: 1 },
{ translateY },
];
return style;
}
if (preVerticalDirection) {
const scale = props.position.interpolate({
inputRange,
outputRange: [1, 1, 0.95]
});
style.transform = [{scale}];
style.opacity = props.position.interpolate({
inputRange,
outputRange: [1, 1, 0.3],
});
return style;
}
const translateX = props.position.interpolate({
inputRange,
outputRange: [SceneWidth, 0, -SceneWidth/5]
});
style.transform = [{ translateX }];
return style;
};
<Router getSceneStyle={getSceneStyle}/>
@YuriyUlantsev Sorry, tried your code and it didn't fix the issue.
@brunolemos I also have the same issue with a listview in a modal scene. If you drag down slowly on the list it correctly scrolls the listview but if you scroll too fast it then starts to dismiss the modal.
Do you have any workarounds at the moment?
@spreech I'm migrating from aksonov/react-native-router-flux to wix/react-native-navigation as it uses 100% native navigation and doesn't have this problems.
@brunolemos You are right, but it is not problem of RNRF, but JS-based navigation... Actually I've created react-native-router-native to use 100% native navigation but with the same syntax as RNRF...
This should be easy.
This works for me. Notice the panHandlers
<Scene
key='login'
component={LoginComponent}
panHandlers={null}
direction='vertical'
title='Login'>
@aksonov cool that you are working on it, I think that's the way to go. I'll keep on eye on the project.
@casoetan Thanks for the tip! This fixes the issue for me as well.
@asokol Is there documentation on migrating to react-native-router-native? And is it compatible with Redux? I attempted to swap libraries and received several errors.
@casoetan This helped. Is there a way to still be able to swipe down on the header or a specific component in the scene to dismiss it?
@casoetan Agreed, I have seen a few interactions that work similar to that and feel very natural. I like the swiping down to dismiss, but maybe add an event on the navigationBar or change the threshold of the responder that listens to the dismiss event.
Most helpful comment
This should be easy.
This works for me. Notice the
panHandlers