androidreact-nativemobilemodal-dialogdimension

How can I fix the missing bottom part in React Native Modal displaying on Android mobile devices?


In React Native, I have an Image in Modal.

However, when the Modal is first displayed, it encounters an error where the bottom part is missing.

This bug when Modal show in first time

When I try to do close Modal and turn it back on, it works fine again with full screen rendering.

When I close and reopen modal again

I tried using Dimensions (width, height)and flex but not working for my case.

What happened and how can i fix this. Please help me.


Solution

  • I found a way to fix it using react-native-modal and screen dimensions instead of windows dimensions. Here is the code that you can try:

    import Modal from 'react-native-modal';
    
    const { width, height } = Dimensions.get('screen');
    
    <Modal
        deviceHeight={height}
        deviceWidth={width}>
        {/* Modal content */}
    </Modal>