Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn Flow strict mode on for Picker #22115

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Libraries/Components/Picker/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ type PickerItemProps = $ReadOnly<{|
* The value to be passed to picker's `onValueChange` callback when
* this item is selected. Can be a string or an integer.
*/
value?: any,
value?: ?(string | number),

/**
* Color of this item's text.
* @platform android
*/
color?: ColorValue,
color?: ?ColorValue,

/**
* Used to locate the item in end-to-end tests.
*/
testID?: string,
testID?: ?string,
|}>;

/**
Expand All @@ -63,14 +63,14 @@ type PickerProps = $ReadOnly<{|
/**
* Value matching value of one of the items. Can be a string or an integer.
*/
selectedValue?: any,
selectedValue?: ?(string | number),

/**
* Callback for when an item is selected. This is called with the following parameters:
* - `itemValue`: the `value` prop of the item that was selected
* - `itemPosition`: the index of the selected item in this picker
* - `itemKey`: the key of the selected item in this picker
*/
onValueChange?: ?(newValue: any, newIndex: number) => mixed,
onValueChange?: ?(itemKey: string, itemValue: string | number) => mixed,

/**
* If set to false, the picker will be disabled, i.e. the user will not be able to make a
Expand Down Expand Up @@ -112,7 +112,7 @@ type PickerProps = $ReadOnly<{|
*
* <Picker
* selectedValue={this.state.language}
* onValueChange={(itemValue, itemIndex) => this.setState({language: itemValue})}>
* onValueChange={(itemKey, itemValue) => this.setState({language: itemValue})}>
* <Picker.Item label="Java" value="java" />
* <Picker.Item label="JavaScript" value="js" />
* </Picker>
Expand Down