MichaelCereda / react-native-form-generator

Generate forms with native look and feel in a breeze
MIT License
377 stars 105 forks source link

Usage with KeyboardAwareScrollView (wix): Get refs to actual TextInputs? #104

Open skizzo opened 7 years ago

skizzo commented 7 years ago

Hi, I'm using wix's KeyboardAwareScrollView, which comes with the feature of auto-scrolling to specific TextInputs.

For this, I'd need a ref to the actual TextInput component, since the principle is this:

<KeyboardAwareScrollView 
  keyboardShouldPersistTaps={true} 
  style={{flex: 1, paddingHorizontal: 10}}
  getTextInputRefs={() => { 
    const {first_name} = this.refs.registrationForm.refs
    return [first_name]
    // --> this leads to error: textInputRef.isFocused is not a function.
  }}
  >

  <Form
    ref='registrationForm'
    >
    <InputField
      ref='first_name'
      placeholder='First Name'
      />
  </Form>
</KeyboardAwareScrollView>

So my question is, is there any way I can get the actual ref to the TextInput in my getTextInputRefs function?

Thanks!