diff --git a/Libraries/Components/CheckBox/CheckBox.android.js b/Libraries/Components/CheckBox/CheckBox.android.js index 5d2e8924cfbcfd..ef1a84730b4655 100644 --- a/Libraries/Components/CheckBox/CheckBox.android.js +++ b/Libraries/Components/CheckBox/CheckBox.android.js @@ -34,6 +34,50 @@ type DefaultProps = { * If the `value` prop is not updated, the component will continue to render * the supplied `value` prop instead of the expected result of any user actions. * + * ``` + * import React from 'react'; + * import { AppRegistry, StyleSheet, Text, View, CheckBox } from 'react-native'; + * + * export default class App extends React.Component { + * constructor(props) { + * super(props); + * this.state = { + * checked: false + * } + * } + * + * toggle() { + * this.setState(({checked}) => { + * return { + * checked: !checked + * }; + * }); + * } + * + * render() { + * const {checked} = this.state; + * return ( + * + * Checked + * + * + * ); + * } + * } + * + * const styles = StyleSheet.create({ + * container: { + * flex: 1, + * flexDirection: 'row', + * alignItems: 'center', + * justifyContent: 'center', + * }, + * }); + * + * // skip this line if using Create React Native App + * AppRegistry.registerComponent('App', () => App); + * ``` + * * @keyword checkbox * @keyword toggle */