1

我正在使用tcomb在其中构建一个表单react-native,我的表单中的一个字段是birthDate: t.maybe(t.Date),但它似乎没有样式

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

在此处输入图像描述

我还添加configoptions

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

1 回答 1

1

看这个:https ://github.com/gcanti/tcomb-form-native/blob/master/lib/stylesheets/bootstrap.js 日期的样式dateValue在第196行

所以这就是我根据需要做的样式:

const Form = t.form.Form;

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

您可以按照相同的方式为 tcomb 中的其他关键部分设置样式(例如:标签Form.stylesheet.controlLabel.normal.fontSize = 14;:)

于 2017-09-27T07:17:47.440 回答