Keyboard aware scroll view Android issue

和自甴很熟 提交于 2019-12-04 11:21:13
Karan Kamdar

I tried the above solution for cross platform support but its not correct. The right and complete solution if you want the focus with automatic scrolling to TextInput to work is to set parameters as follows:

<KeyboardAwareScrollView
  enableOnAndroid={true}
  enableAutomaticScroll={(Platform.OS === 'ios')}
>
...
</KeyboardAwareScrollView>

This is because enableAutomaticScroll is enabled by default and it mixes up with the native Android behaviour to give unexpected results. So set this field to false when Platform is Android.

And yes also set the following in app.json without which it will not work.

"androidStatusBar": {
  "backgroundColor": "#000000"
}

I tried the other solutions and they didn't work for me, but finally I manage to make it work by using the following code:

 <KeyboardAwareScrollView enableOnAndroid={true} extraHeight={130} extraScrollHeight={130}>
  ...
</KeyboardAwareScrollView>

This is how I fixed it:

In app.json I set:

"androidStatusBar": {
  "backgroundColor": "#000000"
}

This fixed the issue, I don't know how but it did. So will leave this here just incase someone else finds it useful.

 <KeyboardAwareScrollView
        enableOnAndroid={true}
        extraScrollHeight={90}
        >
       <Content>
        <View></View>
       </Content>
<KeyboardAwareScrollView/>
Milad Moosavi

Use

<activity android:windowSoftInputMode="adjustResize"></activity>

in your Manifest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!