Nativebase: Form input: switch from form to form closes the keyboard (Android)

Created on 19 Oct 2016  路  4Comments  路  Source: GeekyAnts/NativeBase

I installed the kitchen sink demo from the play store.
In the Form page:

  • enter a value for First Name
  • touch on the Last Name input field.
    -> the touch keyboard closes and you have to touch a second time on the input field to enter a value

desired behavior: keyboard stays open and you can directly enter a value

I have the same issue trying NativeBase in my App. I also tried putting a RN TextInput into a NativeBase Content and still had the problem. After I replaced Content with View it works as expected.
Placing a NativeBase Input component into the View also worked.
After changing back View to Content the error reappeared.
So it seems to be a problem the Content component.

Most helpful comment

Use keyboardShouldPersistTaps prop with Content. Will update the KitchenSink app with this change soon.

All 4 comments

Hi, just to help us narrow down the possibilities, can you try it inside a RN <ScrollView> and check the result?

When I replace the <Content> with <ScrollView> in my app, nothing gets rendered inside anymore and I get a warning: React.createElement: type should not be null.
Well, this could also be a problem with my app, so the test should probably better be done inside the kitchen sink demo. But unfortunately I don't have the source setup, I just downloaded it from the play store.

But I also found another issue with the keyboard which is not a NativeBase problem but perhaps related.
I changed from react-native-router-flux routing to the react native Navigator. When I now transition from my login page to my main page, the keyboard stays open. Also without using NativeBase. I now have to hide the keyboard per code before changing the route.
So perhaps trying to fix this behavior created the other issue?

It is happening because of the <Content> component which uses <ScrollView>. So basically you need to use <View> tag in place of <Content> and on click of button or transition hide the keyboard manually. If you are using RN V > 0.35 use Keyboard.dismiss() method else use hide keyboard react native npm package.

Use keyboardShouldPersistTaps prop with Content. Will update the KitchenSink app with this change soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nschurmann picture nschurmann  路  3Comments

Cotel picture Cotel  路  3Comments

inv2004 picture inv2004  路  3Comments

omerdn1 picture omerdn1  路  3Comments

maphongba008 picture maphongba008  路  3Comments