fix: Add height verification to fix modal dimension (#3573)
This commit is contained in:
parent
8d2226c279
commit
0eb862abdc
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, TouchableWithoutFeedback, View } from 'react-native';
|
import { StyleSheet, TouchableWithoutFeedback, useWindowDimensions, View } from 'react-native';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
import { NavigationContainerProps } from '@react-navigation/core';
|
import { NavigationContainerProps } from '@react-navigation/core';
|
||||||
|
|
||||||
|
@ -23,11 +23,21 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ModalContainer = ({ navigation, children, theme }: IModalContainer): JSX.Element => (
|
export const ModalContainer = ({ navigation, children, theme }: IModalContainer): JSX.Element => {
|
||||||
|
const { height } = useWindowDimensions();
|
||||||
|
const modalHeight = sharedStyles.modalFormSheet.height;
|
||||||
|
return (
|
||||||
<View style={[styles.root, { backgroundColor: `${themes[theme].backdropColor}70` }]}>
|
<View style={[styles.root, { backgroundColor: `${themes[theme].backdropColor}70` }]}>
|
||||||
<TouchableWithoutFeedback onPress={() => navigation.pop()}>
|
<TouchableWithoutFeedback onPress={() => navigation.pop()}>
|
||||||
<View style={styles.backdrop} />
|
<View style={styles.backdrop} />
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
<View style={sharedStyles.modalFormSheet}>{children}</View>
|
<View
|
||||||
|
style={{
|
||||||
|
...sharedStyles.modalFormSheet,
|
||||||
|
height: modalHeight > height ? height : modalHeight
|
||||||
|
}}>
|
||||||
|
{children}
|
||||||
</View>
|
</View>
|
||||||
);
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue