Unverified Commit 0eb862ab authored by Gleidson Daniel Silva's avatar Gleidson Daniel Silva Committed by GitHub
Browse files

fix: Add height verification to fix modal dimension (#3573)

parent 8d2226c2
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 { NavigationContainerProps } from '@react-navigation/core';
......@@ -23,11 +23,21 @@ const styles = StyleSheet.create({
}
});
export const ModalContainer = ({ navigation, children, theme }: IModalContainer): JSX.Element => (
<View style={[styles.root, { backgroundColor: `${themes[theme].backdropColor}70` }]}>
<TouchableWithoutFeedback onPress={() => navigation.pop()}>
<View style={styles.backdrop} />
</TouchableWithoutFeedback>
<View style={sharedStyles.modalFormSheet}>{children}</View>
</View>
);
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` }]}>
<TouchableWithoutFeedback onPress={() => navigation.pop()}>
<View style={styles.backdrop} />
</TouchableWithoutFeedback>
<View
style={{
...sharedStyles.modalFormSheet,
height: modalHeight > height ? height : modalHeight
}}>
{children}
</View>
</View>
);
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment