Tcomb-form-native: t.Maybe(type) adds (Optional) text to label

Created on 16 Nov 2018  路  4Comments  路  Source: gcanti/tcomb-form-native

Version

Tell us which versions you are using:

  • tcomb-form-native v0.6.20
  • react-native v0.56.0

Expected behaviour

Not sure if I'm missing something but changing the label manually on the options doesn't remove the "(optional)" text.

Is there a way to remove this or is not supported?

Thanks.

Most helpful comment

Solution: pass i18n on the options object and set "optional" param to whatever you want

const options = {
  i18n: {
    optional: ''
  },
}

All 4 comments

Solution: pass i18n on the options object and set "optional" param to whatever you want

const options = {
  i18n: {
    optional: ''
  },
}

@gcanti It seems the readme should be updated with this solution cause this works and the solution in the readme doesn't.
The current readme solution is not working for me :

t.form.Form.i18n = {
  optional: '',
  required: ' (required)' // inverting the behaviour: adding a postfix to the required fields
};

Furthermore you also need :

    required: '',

otherwise you will get undefined text in your label which is not wanted. Should be default to ''.

@Ishigamii Thanks for the report but I don't maintain this library anymore (maybe someone else could verify). Cheers.

my bad sorry @alvaromb maybe ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sibelius picture sibelius  路  4Comments

chauthai picture chauthai  路  4Comments

semirturgay picture semirturgay  路  4Comments

muthuraman007 picture muthuraman007  路  4Comments

pgmemk picture pgmemk  路  4Comments