APSL / react-native-keyboard-aware-scroll-view

A ScrollView component that handles keyboard appearance and automatically scrolls to focused TextInput.
MIT License
5.27k stars 646 forks source link

Does the text input need to be the direct descendant of the scroll view? #478

Closed hanayashiki closed 3 years ago

hanayashiki commented 3 years ago

It seems not working with something like this

<KeyboardAwareScrollView>
  <View>
    <TextInput />
  </View>
  <View>
    <TextInput />
  </View>
  <View>
    <TextInput />
  </View>
  <View>
    <TextInput />
  </View>
</KeyboardAwareScrollView>

Thanks!

hanayashiki commented 3 years ago

Sorry, the mistake was

{ editing ? <TextInput autoFocus/> : <Text>{aa}<Text/>
}

when editing changes from false to true, you cannot use autoFocus with the avoiding view at the same time. The avoiding view does not scroll maybe because the keyboard is popped before we can locate the textinput. Instead, you should delay 100ms and then focus.