How do I set the height a React Navigation modal view so once it has appeared it will only cover about half of the screen from the bottom up, and the view below remains visi
Here's an example of how to achieve this in react-navigation
v3.x:
const TestRootStack = createStackNavigator(
{
TestRoot: TestRootScreen,
TestModal: {
screen: TestModalScreen,
navigationOptions: {
/**
* Distance from top to register swipe to dismiss modal gesture. Default (135)
* https://reactnavigation.org/docs/en/stack-navigator.html#gestureresponsedistance
*/
gestureResponseDistance: { vertical: 1000 }, // default is 135 },
},
},
},
{
headerMode: 'none',
mode: 'modal',
transparentCard: true,
},
);
const AppContainer = createAppContainer(TestRootStack);
class TestRootScreen extends React.Component {
render() {
return (
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'blue',
alignItems: 'center',
justifyContent: 'center',
},
});
class TestModalScreen extends React.Component {
render() {
return (
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'transparent',
justifyContent: 'flex-end',
},
innerContainer: {
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
top: 100,
backgroundColor: 'red',
},
});