using tcomb form native in react native

1.4k Views Asked by At

I am using tcomb to build a form in react-native, a field in my form is birthDate: t.maybe(t.Date), but it appears to have no style

const formRegistration = t.struct({
   // other fields
   birthDate: t.maybe(t.Date)
});

enter image description here

I have also added config down the options:

const options = {
  fields : {
     birthDate: {
        label: 'Birth Date',
        mode: 'date',
        config: { 
           format: (date) => myFormatFunction('DD MM YYYY', date),
           dialogMode: 'spinner'
        }
     }
   }
 }
};
1

There are 1 best solutions below

0
On BEST ANSWER

Looking at this: https://github.com/gcanti/tcomb-form-native/blob/master/lib/stylesheets/bootstrap.js The style for the date is in dateValue at line 196

so this is what I did to style it according to the need:

const Form = t.form.Form;

Form.stylesheet.dateValue.normal.borderColor = '#d0d2d3';
Form.stylesheet.dateValue.normal.backgroundColor = '#f0f1f1';
Form.stylesheet.dateValue.normal.borderWidth = 1;

you follow the same way to style other key parts in tcomb (e.g: labels: Form.stylesheet.controlLabel.normal.fontSize = 14;)