Search code examples
android-edittextreact-nativescrollviewtextinputreact-native-scrollview

scrollview can't scroll when focus textinput react native


I have a TextInput inside a ScrollView.

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


Solution

  • 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>