react-native-modest-checkbox
v3.3.0
Published
A modest checkbox component for React Native
Downloads
848
Maintainers
Readme
About
A customizable checkbox component for React Native that supports setting a custom image or component as the checkbox. Inspired by react-native-checkbox.
Install
$ npm install --save react-native-modest-checkbox
$ yarn add react-native-modest-checkbox
Usage
// ... Imagine imports here
import Checkbox from 'react-native-modest-checkbox'
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Checkbox
label='Text for checkbox'
onChange={(checked) => console.log('Checked!')}
/>
</View>
);
}
}
const styles = StyleSheet.create({
// Imagine some amazing styles right here..
})
AppRegistry.registerComponent('App', () => App);
You can use your own images for the checkbox states:
<CheckBox checkedImage={require('./path/to/image.png')} uncheckedImage={require('./path/to/otherImage.png')} />
It can also be used with your own components for the checkbox states:
// Using react-native-vector-icons
<CheckBox
checkedComponent={<Icon name="hand-peace-o" size={25} color="#222" />}
uncheckedComponent={<Icon name="hand-paper-o" size={25} color="#222" />}
label='Custom Component'
onChange={(checked) => console.log('Checked!')}
/>
Props
Contribute
Contributions are welcome. Please open up an issue or create PR if you would like to help out.
Note: If editing the README, please conform to the standard-readme specification.
License
Licensed under the MIT License.
Icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY.