From 06052a2330fc9c1dd0d56c6bbe5a17703f80c6b9 Mon Sep 17 00:00:00 2001 From: Eli White Date: Mon, 14 May 2018 00:09:18 -0700 Subject: [PATCH] Flowtype Switch Reviewed By: yungsters Differential Revision: D7985880 fbshipit-source-id: eaaff2188b8257d09e1bf628d19dae6dfb4c2fc6 --- Libraries/Components/Switch/Switch.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Libraries/Components/Switch/Switch.js b/Libraries/Components/Switch/Switch.js index 88f916cf2040e2..1730e7cbf01989 100644 --- a/Libraries/Components/Switch/Switch.js +++ b/Libraries/Components/Switch/Switch.js @@ -14,6 +14,7 @@ const ColorPropType = require('ColorPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); const React = require('React'); +const ReactNative = require('ReactNative'); const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const ViewPropTypes = require('ViewPropTypes'); @@ -21,11 +22,24 @@ const ViewPropTypes = require('ViewPropTypes'); const createReactClass = require('create-react-class'); const requireNativeComponent = require('requireNativeComponent'); -type DefaultProps = { +import type {ColorValue} from 'StyleSheetTypes'; +import type {ViewProps} from 'ViewPropTypes'; + +type DefaultProps = $ReadOnly<{| value: boolean, disabled: boolean, -}; +|}>; +type Props = $ReadOnly<{| + ...ViewProps, + value?: ?boolean, + disabled?: ?boolean, + onValueChange?: ?Function, + testID?: ?string, + tintColor?: ?ColorValue, + onTintColor?: ?ColorValue, + thumbTintColor?: ?ColorValue, +|}>; /** * Renders a boolean input. * @@ -161,4 +175,4 @@ if (Platform.OS === 'android') { }); } -module.exports = Switch; +module.exports = ((Switch: any): Class>);