tcomb-form-native icon indicating copy to clipboard operation
tcomb-form-native copied to clipboard

nullOption false not working

Open littlehome-eugene opened this issue 6 years ago • 1 comments

Version

Tell us which versions you are using:

  • tcomb-form-native v0.6.11
  • react-native v0.51.0

Expected behaviour

var Event = t.struct({
  site_url: t.maybe(Url),
  // event_start: t.Date,
  // event_end: t.Date,
  name: t.String,

  main_post: t.maybe(t.String),
})

var options = {
  fields: {
    site_url: {
      nullOption: false
    },
    main_post: {
      nullOption: false
    }
  }
};
    let value = {
      site_url: '',
      main_post: ''
    }

        <Form
          ref="form"
          type={Event}
          options={options}
          value={value}
          />
var value = this.refs.form.getValue();

I expect to see site_url and main_post to be '' not null

Actual behaviour

site_url is null, main_post is null

littlehome-eugene avatar Feb 11 '18 09:02 littlehome-eugene

I'm also looking for a way to change null in '' but the nullOption option states that:

Tech note. A value equal to nullOption.value (default '') is converted to null.

I'm wondering what you need then ...

nobady90 avatar Sep 26 '18 10:09 nobady90