【问题标题】:using tcomb form native in react native在 react native 中使用 tcomb form native
【发布时间】:2017-09-26 05:00:39
【问题描述】:

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

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

我还在options 下方添加了config

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

【问题讨论】:

    标签: react-native tcomb-form-native


    【解决方案1】:

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

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

    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;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多