bietkul / react-native-form-builder

Handle your forms in a smart way
MIT License
121 stars 68 forks source link

[iOS] keyboard appearance makes form scroll up an becomes invisible #35

Open omatrot opened 5 years ago

omatrot commented 5 years ago

This is a strange one. The form is working fine on Android.

On iOS as soon as the keyboard shows up the form foes up and disappears in the containing scroll view. I have to drag it back down to interract with the fields.

Any idea?

angelalalachang commented 5 years ago

I was getting this same error, running on iOS, with dependencies: "react-native-keyboard-aware-scroll-view": "^0.5.0".

I was able to fix it by adding a prop to the KeyboardAwareScrollView component on Line 368 of /src/formBuilder/index.js. The original code is:

<KeyboardAwareScrollView
        keyboardShouldPersistTaps="always"
        extraScrollHeight={20}
        {...this.props.scrollViewProps}
      >

I fixed the error by adding the enableAutomaticScroll prop and setting that to false like so:

<KeyboardAwareScrollView
        keyboardShouldPersistTaps="always"
        extraScrollHeight={20}
        enableAutomaticScroll={false}
        {...this.props.scrollViewProps}
      >

This worked for my use case, but you might need to tweak them further. You can refer to https://github.com/APSL/react-native-keyboard-aware-scroll-view for documentation and available props for the KeyboardAwareScrollView component.