react-native-modalbox icon indicating copy to clipboard operation
react-native-modalbox copied to clipboard

SafeAreaView with coverscreen

Open jaysson opened this issue 6 years ago • 2 comments

When coverscreen prop is specified, SafeAreaView inside the modal does not work.

<Modal
        onClosed={onClosed}
        isOpen={true}
        position="bottom"
        coverScreen={true}
        style={{ height: 500 }}
      >
        <SafeAreaView style={composeStyles("occupy")}>
                ...Other code...
        </SafeAreaView>
</Modal>
screen shot 2018-06-18 at 9 06 42 pm

jaysson avatar Jun 18 '18 15:06 jaysson

I have the same problem, and If you don't set the height of Modal, SafeAreaView will work.After setting the height of Modal, SafeAreaView is invalid. @maxs15

yohanceli avatar Jan 24 '19 09:01 yohanceli

I fixed this issue with https://github.com/miyabi/react-native-safe-area library, setting bottom on modal style:

`SafeArea.getSafeAreaInsetsForRootView().then((result) => {
    const bottom = Platform.OS === 'ios' ? result.safeAreaInsets.bottom : 0;
    this.setState({ bottom });
  });`

and:

     `<Modal
        style={[styles.modalContainer, { bottom }]}
        isOpen={isOpen}
        position="bottom"
        backButtonClose={false}
        backdrop={false}
        swipeToClose={false}
      >
        <Text style={styles.modalText}>
          {sdText}, {userName}
        </Text>`

Hope this helps!

Captura de Tela 2020-01-26 às 11 42 59

lklima avatar Jan 26 '20 14:01 lklima