blob: 46891078687eb5b16e90307458046899bc047b6d (
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
|
// @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)} />;
}
}
|