react-native-checkboxcustom
A cross-platform radio and multiple-choice React Native component that checkbox style users can define
Installation
npm install react-native-checkboxcustom --save
Usage
import CheckboxCustom from 'react-native-checkboxcustom'
Example
default checkbox
<CheckboxCustom = = =/>
custom checkbox
component:
{ return <View => <Text =>optionvalue</Text> </View> } { return <View => <Text =>optionvalue</Text> </View> }{ return <CheckboxCustom = = = = = = /> }
styles:
const styles = StyleSheet.create({
checkbox: {
width: 42,
height: 42,
borderRadius: 21,
borderWidth: 2,
borderColor: '#c4c4c4',
justifyContent: 'center',
alignItems: 'center',
marginHorizontal: 8,
marginVertical: 5
},
checkboxSelected: {
borderColor: '#3bcb7e',
},
option: {
fontSize: 16,
color: '#656565'
},
optionSelected: {
color: '#3bcb7e'
},
});
Api
style - {}
custom style of the listoptionStyle - {}
custom style of the option elementoptions - []
required array of optionsselectedOptions - []
optional array of initially selected optionsmaxSelectedOptions - int
optional maximum number of selectable optionsonSelection - function(option){}
option selection callbackrenderIndicator - function(option)
should return a selected/deselected indicator node, default: check mark imagerenderSeparator - function(option)
should return a separator node that is displayed between the options, default: gray linerenderText - function(option)
should return a text node, default: text noderenderRow - function(option)
should return a option viewdisabled - bool
if set to true component is disabled and can't be interacted with