react-native-checkbox

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

import CheckBox from 'react-native-checkbox';

export default class D20170508 extends Component {

    constructor(props){
        super(props);
        this.state = {
           isSe:true
        }
    }
  render() {
    return (
      

           {
                  this.setState({
                      isSe:!data
                  });
              }}
              underlayColor={"transparent"}
              />

      
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

AppRegistry.registerComponent('D20170508', () => D20170508);


/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

import CheckBox from 'react-native-checkbox';

var screenWidth = require("Dimensions").get('window').width;
var screenHeight = require("Dimensions").get('window').height;

export default class D20170508 extends Component {

    constructor(props){
        super(props);
        this.state = {
           isSe:true,
           value:[]
        }
    }

    onChange(value,bl){

        var old_value = this.state.value;

        if(bl == false){
            //true
            old_value.push(value);
        }else{
            //falce
            //
            var index = old_value.indexOf(value);
            old_value.splice(index,1);
        }
        this.setState({
            value:old_value
        });

    }
  render() {
    return (
      

          
              
          
          
              
          
          
              
          
          
              
          

          
              你选中的:{this.state.value}
          


      
    );
  }
}

const styles = StyleSheet.create({
    cellView:{
        width:screenWidth*0.5,
        borderBottomWidth:1,
        borderColor:'#ddd',
        padding:20
    },
  container: {
    flex: 1,
  },
});

AppRegistry.registerComponent('D20170508', () => D20170508);


你可能感兴趣的:(react-native-checkbox)