gcanti/tcomb-form

No checkboxes for Boolean

klooperator opened this issue · 2 comments

Version

Tell us which versions you are using:

  • tcomb-form v0.9.17.
  • react v15.6.1
  • tcomb-validation v3.0.0/v3.4.1

Expected behaviour

Form should return a checkbox ( or a template for it) for a tcomb type Boolean.

Actual behaviour

Form returns a Textbox

Hi,

we are using tcomb-validation in one project to pass struct, option and values to another project that then renders that with tcomb-form. Everything is ok for lists and text, but with Booleans it return textbox ( never invoking checkbox template).

I had inspected the code from tcom-form and in this part:

`
switch (type.meta.kind) {

  case 'irreducible':

    if (type === _tcombValidation2['default'].Boolean) {

      return Checkbox; // eslint-disable-line no-use-before-define

    } else if (type === _tcombValidation2['default'].Date) {

        return Datetime; // eslint-disable-line no-use-before-define

      }

    return Textbox; // eslint-disable-line no-use-before-define

  case 'struct':

  case 'interface':

...
`

It always return checkbox, even thought type.meta.name is Boolean...

Any suggestions?

First suggestion is: make sure you haven't 2 copies of tcomb in your node_modules

#295 (comment)

Hi,
no, no 2 copies of tcomb in any project...