Skip to content

Commit 06052a2

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Flowtype Switch
Reviewed By: yungsters Differential Revision: D7985880 fbshipit-source-id: eaaff2188b8257d09e1bf628d19dae6dfb4c2fc6
1 parent cbe045a commit 06052a2

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Libraries/Components/Switch/Switch.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,32 @@ const ColorPropType = require('ColorPropType');
1414
const NativeMethodsMixin = require('NativeMethodsMixin');
1515
const Platform = require('Platform');
1616
const React = require('React');
17+
const ReactNative = require('ReactNative');
1718
const PropTypes = require('prop-types');
1819
const StyleSheet = require('StyleSheet');
1920
const ViewPropTypes = require('ViewPropTypes');
2021

2122
const createReactClass = require('create-react-class');
2223
const requireNativeComponent = require('requireNativeComponent');
2324

24-
type DefaultProps = {
25+
import type {ColorValue} from 'StyleSheetTypes';
26+
import type {ViewProps} from 'ViewPropTypes';
27+
28+
type DefaultProps = $ReadOnly<{|
2529
value: boolean,
2630
disabled: boolean,
27-
};
31+
|}>;
2832

33+
type Props = $ReadOnly<{|
34+
...ViewProps,
35+
value?: ?boolean,
36+
disabled?: ?boolean,
37+
onValueChange?: ?Function,
38+
testID?: ?string,
39+
tintColor?: ?ColorValue,
40+
onTintColor?: ?ColorValue,
41+
thumbTintColor?: ?ColorValue,
42+
|}>;
2943
/**
3044
* Renders a boolean input.
3145
*
@@ -161,4 +175,4 @@ if (Platform.OS === 'android') {
161175
});
162176
}
163177

164-
module.exports = Switch;
178+
module.exports = ((Switch: any): Class<ReactNative.NativeComponent<Props>>);

0 commit comments

Comments
 (0)