scrollview can't scroll when focus textinput react native

user2427293 picture user2427293 · Sep 28, 2016 · Viewed 11.9k times · Source

I have a TextInput inside a ScrollView.

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

Answer

Mahdieh Shavandi picture Mahdieh Shavandi · Mar 3, 2019

setting

<ScrollView keyboardShouldPersistTaps="always"

in combination with the textInput component below (custom component that i created for text inputs to solve this issue) solved my problem:

<TouchableOpacity
     activeOpacity={1}
     onPress={()=>this.input.focus()}>
     <View pointerEvents="none"
           <TextInput
              ref = {(input) => this.input = input}
           />
     </View>
</TouchableOpacity>