Im using tcomb plugin for generating dynamic form in react native

275 views Asked by At

Everything is ok , but my form consists select drop down in that im getting '-' in the first even though i didn't specify , how to remove it (You can see in screenshot)

Here is the screenshot

 const dForm = t.struct({
    items:t.enums({
      "30":"30",
      "31":"31",
      "32":"32",
      "33":"33",
      "34":"34",
      "35":"35",
      "36":"36",
      "37":"37",
      "38":"38",
      "39":"39"
    },"Items")

      <t.form.Form
          type={dForm}
          ref="mandatory"
      />
2

There are 2 answers

2
Chad Nehemiah On

so I am unable to see if you set the initialState in your component but you may want to have on your componentDidMount method

  getInitialState() {
   return {
     value: {
      "30":"30"
    }
  }

and set your state that way.

0
Ray Coder On

Option 1. You can replace null value (-) first option with this code

items: {
    label: 'Your Label',
    nullOption: {value:'', text: '- - - Choose Items - - -'},
},

Option 2. you can set nullOption false