diff --git a/example/src/CheckboxExample.js b/example/src/CheckboxExample.js deleted file mode 100644 index 934f33832f..0000000000 --- a/example/src/CheckboxExample.js +++ /dev/null @@ -1,67 +0,0 @@ -/* @flow */ - -import React, { Component } from 'react'; -import { - View, - StyleSheet, -} from 'react-native'; -import { - Paragraph, - Checkbox, - Colors, -} from 'react-native-paper'; - -export default class CheckboxExample extends Component { - - static title = 'Checkbox'; - - state = { - checkedNormal: true, - checkedCustom: true, - }; - - render() { - return ( - - - Normal - this.setState(state => ({ checkedNormal: !state.checkedNormal }))} - /> - - - Custom - this.setState(state => ({ checkedCustom: !state.checkedCustom }))} - /> - - - Checked (Disabled) - - - - Unchecked (Disabled) - - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: Colors.white, - padding: 8, - }, - - row: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'space-between', - padding: 8, - }, -}); diff --git a/example/src/ExampleList.js b/example/src/ExampleList.js index e28fa11cbf..38ed2f4ae9 100644 --- a/example/src/ExampleList.js +++ b/example/src/ExampleList.js @@ -10,23 +10,19 @@ import { StyleSheet, } from 'react-native'; import { Colors, TouchableRipple } from 'react-native-paper'; -import ButtonExample from './ButtonExample'; import CardExample from './CardExample'; -import CheckboxExample from './CheckboxExample'; -import DividerExample from './DividerExample'; -import PaperExample from './PaperExample'; import RippleExample from './RippleExample'; -import RadioButtonExample from './RadioButtonExample'; +import PaperExample from './PaperExample'; import TextExample from './TextExample'; +import ButtonExample from './ButtonExample'; +import DividerExample from './DividerExample'; export const examples = { button: ButtonExample, card: CardExample, - checkbox: CheckboxExample, divider: DividerExample, paper: PaperExample, ripple: RippleExample, - radio: RadioButtonExample, text: TextExample, }; diff --git a/example/src/RadioButtonExample.js b/example/src/RadioButtonExample.js deleted file mode 100644 index eebc314539..0000000000 --- a/example/src/RadioButtonExample.js +++ /dev/null @@ -1,67 +0,0 @@ -/* @flow */ - -import React, { Component } from 'react'; -import { - View, - StyleSheet, -} from 'react-native'; -import { - Paragraph, - RadioButton, - Colors, -} from 'react-native-paper'; - -export default class RadioButtonExample extends Component { - - static title = 'Radio button'; - - state = { - checkedNormal: true, - checkedCustom: true, - }; - - render() { - return ( - - - Normal - this.setState(state => ({ checkedNormal: !state.checkedNormal }))} - /> - - - Custom - this.setState(state => ({ checkedCustom: !state.checkedCustom }))} - /> - - - Checked (Disabled) - - - - Unchecked (Disabled) - - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: Colors.white, - padding: 8, - }, - - row: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'space-between', - padding: 8, - }, -}); diff --git a/index.js b/index.js index 944cd70004..b296ab95ca 100644 --- a/index.js +++ b/index.js @@ -5,13 +5,12 @@ export { default as withTheme } from './src/core/withTheme'; export * as Colors from './src/styles/colors'; -export { default as Button } from './src/components/Button'; -export { default as Card } from './src/components/Card'; -export { default as Checkbox } from './src/components/Checkbox'; export { default as Paper } from './src/components/Paper'; -export { default as RadioButton } from './src/components/RadioButton'; export { default as TouchableRipple } from './src/components/TouchableRipple'; +export { default as Button } from './src/components/Button'; +export { default as Card } from './src/components/Card'; + export { default as Caption } from './src/components/Typography/Caption'; export { default as Headline } from './src/components/Typography/Headline'; export { default as Paragraph } from './src/components/Typography/Paragraph'; diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js deleted file mode 100644 index 9e5fa2797d..0000000000 --- a/src/components/Checkbox.js +++ /dev/null @@ -1,82 +0,0 @@ -/* @flow */ - -import React, { - PropTypes, -} from 'react'; -import { - StyleSheet, -} from 'react-native'; -import color from 'color'; -import Icon from './Icon'; -import TouchableRipple from './TouchableRipple'; -import withTheme from '../core/withTheme'; -import type { Theme } from '../types/Theme'; - -type Props = { - checked: boolean; - disabled?: boolean; - onPress?: Function; - color?: string; - theme: Theme; -} - -const Checkbox = (props: Props) => { - const { - checked, - disabled, - onPress, - theme, - } = props; - - const checkboxColor = props.color || theme.colors.primary; - - let rippleColor, checkboxStyle; - - if (disabled) { - rippleColor = 'rgba(0, 0, 0, .16)'; - checkboxStyle = { color: 'rgba(0, 0, 0, .26)' }; - } else { - rippleColor = color(checkboxColor).clearer(0.32).rgbaString(); - if (checked) { - checkboxStyle = { color: checkboxColor }; - } - } - - return ( - - - - ); -}; - -Checkbox.propTypes = { - checked: PropTypes.bool.isRequired, - disabled: PropTypes.bool, - onPress: PropTypes.func, - color: PropTypes.string, - theme: PropTypes.object.isRequired, -}; - -const styles = StyleSheet.create({ - container: { - borderRadius: 18, - }, - - checkbox: { - /* FIXME: using opacity doesn't work properly with TouchableHighlight */ - color: 'rgba(0, 0, 0, .54)', - margin: 6, - }, -}); - -export default withTheme(Checkbox); diff --git a/src/components/RadioButton.js b/src/components/RadioButton.js deleted file mode 100644 index a93e2ad37e..0000000000 --- a/src/components/RadioButton.js +++ /dev/null @@ -1,82 +0,0 @@ -/* @flow */ - -import React, { - PropTypes, -} from 'react'; -import { - StyleSheet, -} from 'react-native'; -import color from 'color'; -import Icon from './Icon'; -import TouchableRipple from './TouchableRipple'; -import withTheme from '../core/withTheme'; -import type { Theme } from '../types/Theme'; - -type Props = { - checked: boolean; - disabled?: boolean; - onPress?: Function; - color?: string; - theme: Theme; -} - -const RadioButton = (props: Props) => { - const { - checked, - disabled, - onPress, - theme, - } = props; - - const radioColor = props.color || theme.colors.primary; - - let rippleColor, radioStyle; - - if (disabled) { - rippleColor = 'rgba(0, 0, 0, .16)'; - radioStyle = { color: 'rgba(0, 0, 0, .26)' }; - } else { - rippleColor = color(radioColor).clearer(0.32).rgbaString(); - if (checked) { - radioStyle = { color: radioColor }; - } - } - - return ( - - - - ); -}; - -RadioButton.propTypes = { - checked: PropTypes.bool.isRequired, - disabled: PropTypes.bool, - onPress: PropTypes.func, - color: PropTypes.string, - theme: PropTypes.object.isRequired, -}; - -const styles = StyleSheet.create({ - container: { - borderRadius: 18, - }, - - radio: { - /* FIXME: using opacity doesn't work properly with TouchableHighlight */ - color: 'rgba(0, 0, 0, .54)', - margin: 6, - }, -}); - -export default withTheme(RadioButton); diff --git a/src/components/TouchableRipple/TouchableRipple.android.js b/src/components/TouchableRipple/TouchableRipple.android.js index 3014efdaad..6429892484 100644 --- a/src/components/TouchableRipple/TouchableRipple.android.js +++ b/src/components/TouchableRipple/TouchableRipple.android.js @@ -16,7 +16,7 @@ type Props = { onPress?: ?Function; onPressIn?: ?Function; onPressOut?: ?Function; - rippleColor: string; + rippleColor?: string; children?: any; style?: any; } diff --git a/src/components/TouchableRipple/TouchableRipple.js b/src/components/TouchableRipple/TouchableRipple.js index 5c551e0f9c..b1e6e90ff1 100644 --- a/src/components/TouchableRipple/TouchableRipple.js +++ b/src/components/TouchableRipple/TouchableRipple.js @@ -16,7 +16,7 @@ type Props = { onPress?: ?Function; onPressIn?: ?Function; onPressOut?: ?Function; - rippleColor: string; + rippleColor?: string; children?: any; style?: any; }