diff options
| author | anderklander <anderklander@gmail.com> | 2018-04-12 09:41:13 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-04-16 12:01:12 +0200 |
| commit | 7f485b287d9a501e7de11d470d68f1e698ff10c2 (patch) | |
| tree | 81767a79b7d47f813da5ef2edcff150a243b3416 /app/components/Switch.android.js | |
| parent | c9f2ec62790a62e674b1252a6a18dec451d17bf3 (diff) | |
| download | mullvadvpn-7f485b287d9a501e7de11d470d68f1e698ff10c2.tar.xz mullvadvpn-7f485b287d9a501e7de11d470d68f1e698ff10c2.zip | |
JS fixes for react-native
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) } /> + ); + } +} |
