jeremybarbet / react-native-modalize

A highly customizable modal/bottom sheet that loves scrolling content.
https://jeremybarbet.github.io/react-native-modalize
MIT License
2.84k stars 298 forks source link

Modal closes when focusing on TextInput Keyboard #338

Open mateus-cazuza opened 3 years ago

mateus-cazuza commented 3 years ago

Describe the bug I'm using the repository's own demo [expo].

Always Open Mode

In this type of modal we have two positions: 'Initial' and 'Top'. When I make the Swipe Up gesture the modal is full screen 'Top'. When this is full screen I render a TextInput that when receiving focus the keyboard appears and the modal closes returning to the 'Inital' position.

How can I get an Input in this type of modal without it closing?

Reproduce Use the Demo provided by that repository.

Edit the AlwaysOpen File, insert the TextInput component into it

Dependencies:

samirdiaz0 commented 3 years ago

I'm having the same problem, but with react-native-modalize v2.0.8 Is there any news?

Awe1alex commented 3 years ago

The solution that worked for me: add avoiKeyboardLikeIOS={true} change keyboardAvoidingBehavior="height" (default is 'padding', that makes whitespace on bottom).

Update: Better set keyboardAvoidingBehavior={Platform.OS == 'android' ? 'height' : 'padding'}, because if you have multiple inputs on IOS 'height' causes some bugs, with 'padding' everything works fine on IOS

Also, there is jumping on Android devices on input focus my solution was to set modalStyle to: { flex: 1, marginTop: top + 35 }. top variable comes from useSafeAreaInsets() from react-native-safe-area-context

wdospinal commented 3 years ago

The keyboard is in another modal, I don’t know why is closing the one with react-native-modalize

suhaillilac commented 3 years ago

try 'adjustToContentHeight' to modalize. It worked for me.

AlexMachin1997 commented 1 year ago

I believe I'm experiencing this weird issue, not sure why focusing on the input closes the modal down.

asRizvi888 commented 1 year ago

Having the same issue here. Selecting the TextInput closes the Modal , even though the TextInput is within the Modal.