material-top-tabs closes keyboard on first focus

748 views Asked by At

I am using "react-native": "0.70.4", with the @react-navigation/material-top-tabs to make a custom bottomsheet with top tabs inside. When clicking the TextInput in tab nr 2 it dismiss the keyboard, but if i click again it does not happen. I tried multiple ways, it happens when there is 3 or more tabs. It works as intended in the other tabs.

Tabs example

Example of the bottomsheet and tabs. If I click the "søk" (TextInput) in tab "test2". It would open and close the keyboard the first time I click it.

enter image description here

this after the second time I click the TextInput.

I am thinking of using android:windowSoftInputMode="adjustNothing" but this doesnt let me use an useffect/keyboard lisnter

3

There are 3 answers

5
JSONCMD On

looks like there is not enough space to open the keyboard in the BottomSheet menu, should you use const snapPoints = useMemo(() => ["30%", "50%"], []); for snapPoints?

0
KLK On

I made a custom tab component with scrollView. the issue is with react-native-pager-view. unable to resize or move things so that it can reach all components when using pager-view.

1
KLK On

I had to change android:windowSoftInputMode="adjustResize" with adjustPan, change my layout to use flex instead of height and change tabBarHideOnKeyboard: true to false.

It makes me have to change quite a bit of code. But atleast the bug is gone.