Is your feature request related to a problem? Please describe.
The problem: KeyboardAwareScrollView doesn't handle this scenario well:
bottomOffset value of KeyboardAwareScrollView is set to a state value (e.g.20)
TextInput A - currently at the screen bottom - is tapped
- Soft Keyboard shows and scrolls
TextInput A above it correctly (with a bottom offset of 20)
TextInput A has these properties:
returnKeyType={"next"}
submitBehavior={"submit"}
onSubmitEditing={() => {
setBottomOffset(40) // change bottomOffset used in KeyboardAwareScrollView parent
textInputB.current?.focus()
}}
- User taps on soft keyboard's "Next" button
- KeyboardAwareScrollView does not smoothly jump to
TextInput B's bottom (with a bottom offset of 40).
Describe the solution you'd like
In case of a complex form that optionally shows and hides errors or info texts between TextInputs based on state that can change while the soft keyboard is shown, it would be handy to define the bottomOffset property either
- a: as a number (as it is at the time of writing this), or
- b: additionally, add
bottomOffsets as an object of the type {[nativeID: string]: number | undefined}. The nativeID could be used internally to determine the scroll target not only based on the bottomOffset property, but also consider bottomOffsets?.[nativeID] and use it as an override, if given.
Describe alternatives you've considered
Manually measuring and scrolling to a focused TextInput, which defeats the purpose of this great library.
Is your feature request related to a problem? Please describe.
The problem:
KeyboardAwareScrollViewdoesn't handle this scenario well:bottomOffsetvalue ofKeyboardAwareScrollViewis set to a state value (e.g.20)TextInput A- currently at the screen bottom - is tappedTextInput Aabove it correctly (with a bottom offset of20)TextInput Ahas these properties:TextInput B's bottom (with a bottom offset of40).Describe the solution you'd like
In case of a complex form that optionally shows and hides errors or info texts between TextInputs based on state that can change while the soft keyboard is shown, it would be handy to define the
bottomOffsetproperty eitherbottomOffsetsas an object of the type{[nativeID: string]: number | undefined}. ThenativeIDcould be used internally to determine the scroll target not only based on thebottomOffsetproperty, but also considerbottomOffsets?.[nativeID]and use it as an override, if given.Describe alternatives you've considered
Manually measuring and scrolling to a focused TextInput, which defeats the purpose of this great library.