A customizable checkbox component for React Native that supports setting a custom image or component as the checkbox. Inspired by react-native-checkbox.
$ npm install --save react-native-modest-checkbox
$ yarn add react-native-modest-checkbox
// ... 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!')}
/>
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.
Author: tiaanduplessis
GitHub: https://github.com/tiaanduplessis/react-native-modest-checkbox
#react-native #programming