Permalink
Browse files

Flowtype PickerIOS

Reviewed By: yungsters

Differential Revision: D7985960

fbshipit-source-id: 9fbce5fafe47bee1d2a527c72f3ebef85d26f9f1
  • Loading branch information...
TheSavior authored and facebook-github-bot committed May 14, 2018
1 parent d796129 commit 1c66cdc7e8ce8190dfbef76629601497446b2b0a
Showing with 24 additions and 2 deletions.
  1. +24 −2 Libraries/Components/Picker/PickerIOS.ios.js
@@ -14,6 +14,7 @@
const NativeMethodsMixin = require('NativeMethodsMixin');
const React = require('React');
const ReactNative = require('ReactNative');
const PropTypes = require('prop-types');
const StyleSheet = require('StyleSheet');
const StyleSheetPropType = require('StyleSheetPropType');
@@ -26,6 +27,17 @@ const createReactClass = require('create-react-class');
const itemStylePropType = StyleSheetPropType(TextStylePropTypes);
const requireNativeComponent = require('requireNativeComponent');
import type {ColorValue} from 'StyleSheetTypes';
import type {ViewProps} from 'ViewPropTypes';
type Props = $ReadOnly<{|
...ViewProps,
color?: ?ColorValue,
label: string,
testID?: ?string,
value?: ?any,
|}>;
const PickerIOS = createReactClass({
displayName: 'PickerIOS',
mixins: [NativeMethodsMixin],
@@ -106,7 +118,13 @@ const PickerIOS = createReactClass({
},
});
PickerIOS.Item = class extends React.Component {
PickerIOS.Item = class extends React.Component<
$ReadOnly<{|
label: string,
value?: ?any,
color?: ?ColorValue,
|}>,
> {
static propTypes = {
value: PropTypes.any, // string or integer basically
label: PropTypes.string,
@@ -119,6 +137,10 @@ PickerIOS.Item = class extends React.Component {
}
};
class TypedPickerIOS extends ReactNative.NativeComponent<Props> {
static Item = PickerIOS.Item;
}
const styles = StyleSheet.create({
pickerIOS: {
// The picker will conform to whatever width is given, but we do
@@ -144,4 +166,4 @@ const RCTPickerIOS = requireNativeComponent(
},
);
module.exports = PickerIOS;
module.exports = ((PickerIOS: any): Class<TypedPickerIOS>);

0 comments on commit 1c66cdc

Please sign in to comment.