<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          tcomb-form-native表單處理控件

          聯(lián)合創(chuàng)作 · 2023-09-25 20:38

          tcomb-form-native 是 React Native 強大的表單處理控件,支持 JSON 模式,可插拔的外觀和感覺。

          在線演示:http://react.rocks/example/tcomb-form-native

          安裝:

          npm install tcomb-form-native

          示例:

          // index.ios.js
          'use strict';
          var React = require('react-native');
          var t = require('tcomb-form-native');
          var { AppRegistry, StyleSheet, Text, View, TouchableHighlight } = React;
          var Form = t.form.Form;
          // here we are: define your domain model
          var Person = t.struct({
            name: t.Str,              // a required string
            surname: t.maybe(t.Str),  // an optional string
            age: t.Num,               // a required number
            rememberMe: t.Bool        // a boolean
          });
          var options = {}; // optional rendering options (see documentation)
          var AwesomeProject = React.createClass({
            onPress: function () {
              // call getValue() to get the values of the form
              var value = this.refs.form.getValue();
              if (value) { // if validation fails, value will be null
                console.log(value); // value here is an instance of Person
              }
            },
            render: function() {
              return (
                <View style={styles.container}>
                  {/* display */}
                  <Form
                    ref="form"
                    type={Person}
                    options={options}
                  />
                  <TouchableHighlight style={styles.button} onPress={this.onPress} underlayColor='#99d9f4'>
                    <Text style={styles.buttonText}>Save</Text>
                  </TouchableHighlight>
                </View>
              );
            }
          });
          var styles = StyleSheet.create({
            container: {
              justifyContent: 'center',
              marginTop: 50,
              padding: 20,
              backgroundColor: '#ffffff',
            },
            title: {
              fontSize: 30,
              alignSelf: 'center',
              marginBottom: 30
            },
            buttonText: {
              fontSize: 18,
              color: 'white',
              alignSelf: 'center'
            },
            button: {
              height: 36,
              backgroundColor: '#48BBEC',
              borderColor: '#48BBEC',
              borderWidth: 1,
              borderRadius: 8,
              marginBottom: 10,
              alignSelf: 'stretch',
              justifyContent: 'center'
            }
          });
          AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

          結(jié)果:

           

          瀏覽 23
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  尻屄视频在线播放 | 免费看的A片 | 俺也来俺也去WWW色 | 最新偷拍网址 | 中文字幕乱伦 |