scrollview can't scroll when focus textinput r

2019-02-26 06:54发布

问题:

I have a TextInput inside a ScrollView.

The scroll isn't working when the TextInput is on focus. This problem is only affecting Android.

回答1:

That is the expected behavior.

For more information Official TextInput documentation

You might want to try something like this: react-native-aware-scroll-view



回答2:

This is a very good example: http://blog.arjun.io/react-native/mobile/cross-platform/2016/04/01/handling-the-keyboard-in-react-native.html

The thing that was really important for me was to add:

android:windowSoftInputMode="adjustResize"

in AndroidManifest.xml in order to focus the textInput



回答3:

In scrollView use keyboardShouldPersistTaps

<ScrollView keyboardShouldPersistTaps="handled">

it solve your problem

check docs here https://facebook.github.io/react-native/docs/scrollview.html#keyboarddismissmode