1.0.7 • Published 7 years ago

react-native-sf-checkbox v1.0.7

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

react-native-sf-checkbox

checkbox 选择器

安装

npm install react-native-sf-checkbox

例子

import React, {Component} from 'react';
import {
    View,
} from 'react-native';
import {
    SFCheckbox,
    SFListCheckBox
}from 'react-native-sf-checkbox';

type Props = {};
export default class App extends Component<Props> {

    constructor(props) {
        super(props);
        this.state = {
            state: false,
         
        }
    }

    render() {
        return (
            <View style={{flex: 1}}>
                    <TouchableOpacity
                    activeOpacity={1}
                    style={{
                        width: 100,
                        height: 100,
                        backgroundColor: 'red'
                    }}
                    onPress={() => {
                        alert( this.refs['box'].getChecked());
                        this.refs['box'].setChecked(this.state.states);

                        this.setState({
                            states: !this.state.states
                        })
                    }}/>


                <SFListCheckBox
                    style={{
                        marginLeft: 10,
                        marginTop: 10
                    }}
                    direction={'column'}
                    texts={['这是第一个', '第二个选项']}
                    isSingle={true}
                    spacing={20}
                    selectedIndex={1}
                    iconSize={[15, 15]}
                    titleSize={15}
                    titleColor={'blue'}
                    onChange={(data) =>{

                    }}
                />

                <SFCheckbox
                    style={{
                        marginTop: 10,
                        marginLeft: 10
                    }}
                    ref={'box'}
                    title={'男'}
                    defaultStatus={false}
                    iconSize={[15, 15]}
                    titleSize={14}
                />
            </View>
        );
    }
}

Props

  • 单选模式
parametertyperequireddescriptiondefault
stylestyleno样式null
selectedImgnumberno自定义选中图片null 
unSelectImgnumberno自定义未选中图片null 
onChangearray or numberno返回选中下标null   
iconSizearraynosize数组null   
titleSizenumberno字体大小null   
titleColorStringno字体颜色null   
spacingnumberno间距null   
titlestringno标题null
  • 多选模式  
parametertyperequireddescriptiondefault
directionstring('column','row')no横竖显示null
textsarrayno名称数组null
isSingleboolno是否为单选模式null
defaultColorstringno默认字体颜色null
selectColorstringno选中字体颜色null
stylestyleno样式null
selectedImgnumberno自定义选中图片null 
unSelectImgnumberno自定义未选中图片null 
onChangearray or numberno返回选中下标null   
iconSizearraynosize数组null   
titleSizenumberno字体大小null   
titleColorStringno字体颜色null   
spacingnumberno间距null   
1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago