diff options
Diffstat (limited to 'app/components/Switch.android.js')
| -rw-r--r-- | app/components/Switch.android.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/components/Switch.android.js b/app/components/Switch.android.js new file mode 100644 index 0000000000..17bb976186 --- /dev/null +++ b/app/components/Switch.android.js @@ -0,0 +1,30 @@ +// @flow +import * as React from 'react'; +import { Switch as _Switch } from 'react-native'; + +export type SwitchProps = { + isOn: boolean; + onChange?: (isOn: boolean) => void; +}; + +type State = { +}; + +export default class Switch extends React.Component<SwitchProps, State> { + static defaultProps: SwitchProps = { + isOn: false, + onChange: ()=>{}, + }; + + state = { + }; + + render() { + const { isOn, ...otherProps } = this.props; + return ( + <_Switch { ...otherProps } + value={ isOn } + onValueChange={ this.props.onChange(isOn) } /> + ); + } +} |
