blob: 17bb97618672ebd15c7eb6609ad1888c4fbb5478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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) } />
);
}
}
|