Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The word "undefined" shows up wherever I use the <Form /> tag #533

Closed
ameshkin opened this issue Sep 24, 2018 · 3 comments
Closed

The word "undefined" shows up wherever I use the <Form /> tag #533

ameshkin opened this issue Sep 24, 2018 · 3 comments

Comments

@ameshkin
Copy link

Version

Tell us which versions you are using:

  • tcomb-form-native v0.6.17

Issue

The word undefined shows up wherever I put this form tag.

This is definitely coming from the form tag

My code is here

    <View>

        <Form
          ref="form"
          type={ Person }
          options={ options }
        />

        <Button block
              style={formStyles.submitButton}
              onPress={this.handleSubmit}
              >
          <Text style={formStyles.submitButtonText}>
            SIGN UP
          </Text>
        </Button>
      </View>
@smerkousdavid
Copy link

I'm not entirely sure what the options you provided are but the latest commit broke all of my forms by adding the undefined to my labels because the else statement that's supposed to handle i18n optional / required fields breaks the label by adding an undefined if you don't include it in your options. I don't include an optional and required field in my labels so that was kind of annoying, but here is a temporary fix that I've got working.

const formOptions = {
  fields: {
     firstInput: {
       label: 'My label',
       placeholder: 'Required',
       i18n: {
         optional: '',
         required: ''
       }
     }
  }
};

const formType = tf.struct({
    firstInput: tf.String
});

...

<Form
  ref={ref => this.form = ref}
  type={formType}
  options={formOptions}
/>

...

@tonycoco
Copy link
Contributor

#531 fixes this

@alvaromb
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants