From 0eb862abdc24faf318f11d2edf903abccf32be09 Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Tue, 11 Jan 2022 11:35:06 -0300 Subject: [PATCH] fix: Add height verification to fix modal dimension (#3573) --- .../MasterDetailStack/ModalContainer.tsx | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/app/stacks/MasterDetailStack/ModalContainer.tsx b/app/stacks/MasterDetailStack/ModalContainer.tsx index aeea3d88..376ff876 100644 --- a/app/stacks/MasterDetailStack/ModalContainer.tsx +++ b/app/stacks/MasterDetailStack/ModalContainer.tsx @@ -1,5 +1,5 @@ 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 => ( - - navigation.pop()}> - - - {children} - -); +export const ModalContainer = ({ navigation, children, theme }: IModalContainer): JSX.Element => { + const { height } = useWindowDimensions(); + const modalHeight = sharedStyles.modalFormSheet.height; + return ( + + navigation.pop()}> + + + height ? height : modalHeight + }}> + {children} + + + ); +};