KeyboardAvoidingView + submit Button question

  1. SDK Version: 47.0.0
  2. Platforms(Android/iOS/web/all): all

I have a form (using Formik) with a few fields and I wrapped everything in a KeyboardAvoidingView following this example:

I works fine, but when I click the submit button it just hides the keyboard without executing the onPress event.

Once the keyboard is hidden, the onPress fires as expected.

What could be preventing the button from working properly?

Here’s the full Form:

      <Form
        style={s`p-3 my-3`}
        initialValues={{
          accountType: "",
          email: "",
          message: "",
          name: "",
          studentName: "",
          teacherEmail: "",
          teacherName: "",
          username: "",
        }}
        onSubmit={handleSubmit}
        validationSchema={validationSchema}>
          <FormTextInput
            // label="Full Name"
            name="name"
            placeholder="Full Name"
            required
          />
          <FormTextInput
            keyboardType="email-address"
            // label="Email"
            name="email"
            placeholder="Email Address"
            required
          />
          <FormTextInput
            // label="Full Name"
            name="username"
            placeholder="Username (helpful)"
          />
          <FormTextInput
            // label="Full Name"
            name="studentName"
            placeholder="Student Name (helpful)"
            visible={selectedAccountType?.value === AccountTypesEnum.parent.id}
          />
          <FormTextInput
            // label="Teacher Name"
            name="teacherName"
            placeholder="Teacher Name"
            required
          />
          <FormTextInput
            keyboardType="email-address"
            // label="Teacher Email"
            name="teacherEmail"
            placeholder="Teacher Email Address (helpful)"
          />
          <FormTextInput
            // label="Message"
            maxLength={1000}
            multiline
            name="message"
            numberOfLines={10}
            placeholder="Please tell us what you need help with in as much detail as possible."
            required
          />
          <SubmitButton
            // style={Platform.OS === "android" ? s`mb-6` : s`mb-2`}s
            loading={loading}>
            Send
          </SubmitButton>
	  </Form>

and here’s the Form implementation:

    <KeyboardAvoidingView
      behavior={Platform.OS === "ios" ? "padding" : "height"}
      style={[s`flex-1`, style]}>
      <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
        <Formik
          enableReinitialize
          initialValues={initialValues}
          onSubmit={onSubmit}
          validationSchema={validationSchema}
          {...otherProps}>
          {() => children}
        </Formik>
      </TouchableWithoutFeedback>
    </KeyboardAvoidingView>

Thanks for any help!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.