tcomb-form-native
tcomb-form-native copied to clipboard
nullOption false not working
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
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 ...