summaryrefslogtreecommitdiffhomepage
path: root/app/components/Switch.android.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-04-16 12:01:39 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-04-16 12:01:39 +0200
commitc92ea97d9180fe05ab1adb35a4af0bcb19b12ec9 (patch)
treeddd20a989d7c5b0fc9cae12724970d69976f889c /app/components/Switch.android.js
parentc9f2ec62790a62e674b1252a6a18dec451d17bf3 (diff)
parent898dd74e5ac86dac2638dc26975b22a9fb0392d4 (diff)
downloadmullvadvpn-c92ea97d9180fe05ab1adb35a4af0bcb19b12ec9.tar.xz
mullvadvpn-c92ea97d9180fe05ab1adb35a4af0bcb19b12ec9.zip
Merge branch 'rn-compatibility'
Diffstat (limited to 'app/components/Switch.android.js')
-rw-r--r--app/components/Switch.android.js30
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) } />
+ );
+ }
+}