{"id":15036531,"url":"https://github.com/react-native-picker/picker","last_synced_at":"2025-05-12T13:14:15.780Z","repository":{"id":38172863,"uuid":"173217201","full_name":"react-native-picker/picker","owner":"react-native-picker","description":"Picker is a cross-platform UI component for selecting an item from a list of options.","archived":false,"fork":false,"pushed_at":"2025-04-02T15:09:51.000Z","size":140684,"stargazers_count":1643,"open_issues_count":230,"forks_count":301,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-12T13:13:47.727Z","etag":null,"topics":["android","hacktoberfest","ios","macos","picker","react-native","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/react-native-picker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-01T01:55:16.000Z","updated_at":"2025-05-11T18:45:09.000Z","dependencies_parsed_at":"2023-12-15T08:27:41.988Z","dependency_job_id":"f7ec3f7e-759a-4172-8505-13798bd8e5f6","html_url":"https://github.com/react-native-picker/picker","commit_stats":{"total_commits":442,"total_committers":136,"mean_commits":3.25,"dds":0.8099547511312217,"last_synced_commit":"93c30bb661f9b11ebfd4dd42dba6b4fdff950bf9"},"previous_names":["react-native-community/react-native-picker"],"tags_count":399,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-picker%2Fpicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-picker%2Fpicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-picker%2Fpicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-picker%2Fpicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/react-native-picker","download_url":"https://codeload.github.com/react-native-picker/picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745196,"owners_count":21957319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","hacktoberfest","ios","macos","picker","react-native","windows"],"created_at":"2024-09-24T20:31:27.208Z","updated_at":"2025-05-12T13:14:15.730Z","avatar_url":"https://github.com/react-native-picker.png","language":"JavaScript","readme":"\n#  `@react-native-picker/picker`\n\n\n\n[![npm version](https://img.shields.io/npm/v/@react-native-picker/picker.svg)](https://www.npmjs.com/package/@react-native-picker/picker)\n[![Build](https://github.com/react-native-picker/picker/workflows/Build/badge.svg)](https://github.com/react-native-picker/picker/actions) ![Supports Android, iOS, MacOS, and Windows](https://img.shields.io/badge/platforms-android%20|%20ios|%20macos|%20windows-lightgrey.svg) ![MIT License](https://img.shields.io/npm/l/@react-native-picker/picker.svg) [![Lean Core Extracted](https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg)](https://github.com/facebook/react-native/issues/23313)\n\n| Android | iOS | PickerIOS |\n| --- | --- | --- |\n| \u003cimg src=\"./screenshots/picker-android.png\" width=\"220\"\u003e | \u003cimg src=\"./screenshots/picker-ios.png\" width=\"220\"\u003e | \u003cimg src=\"./screenshots/pickerios-ios.png\" width=\"220\"\u003e\n\n| Windows | MacOS |\n| --- | --- |\n| \u003cimg src=\"./screenshots/picker-windows.png\" width=\"344\"\u003e | \u003cimg src=\"./screenshots/picker-macos.png\" width=\"344\"\u003e\n\n## Supported Versions\n\n| @react-native-picker/picker | react-native | react-native-windows |\n| --- | --- | --- |\n| \u003e= 2.0.0 | 0.61+ | 0.64+ |\n| \u003e= 1.16.0 | 0.61+ | 0.61+ |\n| \u003e= 1.2.0 | 0.60+ or 0.59+ with [Jetifier](https://www.npmjs.com/package/jetifier) | N/A |\n| \u003e= 1.0.0 | 0.57 | N/A |\n   \n## Getting started\n\n`$ npm install @react-native-picker/picker --save`\n\nor\n\n`$ yarn add @react-native-picker/picker`\n\n### For React Native v0.60 and above (Autolinking)\n\nAs [react-native@0.60](https://reactnative.dev/blog/2019/07/03/version-60) and above supports autolinking there is no need to run the linking process. \nRead more about autolinking [here](https://github.com/react-native-picker/cli/blob/master/docs/autolinking.md). This is supported by `react-native-windows@0.64` and above. \n\n#### iOS\nCocoaPods on iOS needs this extra step:\n\n```\nnpx pod-install\n```\n\n#### Android\nNo additional step is required.\n\n\u003cdetails\u003e\n\u003csummary\u003eWindows (expand for details)\u003c/summary\u003e\n\n#### Windows\nUsage in Windows without autolinking requires the following extra steps:\n\n##### Add the `ReactNativePicker` project to your solution.\n\n1. Open the solution in Visual Studio 2019\n2. Right-click Solution icon in Solution Explorer \u003e Add \u003e Existing Project\n   Select `D:\\dev\\RNTest\\node_modules\\@react-native-picker\\picker\\windows\\ReactNativePicker\\ReactNativePicker.vcxproj`\n\n##### **windows/myapp.sln**\nAdd a reference to `ReactNativePicker` to your main application project. From Visual Studio 2019:\n\nRight-click main application project \u003e Add \u003e Reference...\n  Check `ReactNativePicker` from Solution Projects.\n\n##### **app.cpp**\nAdd `#include \"winrt/ReactNativePicker.h\"` to the headers included at the top of the file.\n\nAdd `PackageProviders().Append(winrt::ReactNativePicker::ReactPackageProvider());` before `InitializeComponent();`.\n\u003c/details\u003e\n\n#### MacOS\nCocoaPods on MacOS needs this extra step (called from the MacOS directory)\n\n```\npod install\n```\n\n\n\u003cdetails\u003e\n   \u003csummary\u003eReact Native below 0.60 (Link and Manual Installation)\u003c/summary\u003e\n\nThe following steps are only necessary if you are working with a version of React Native lower than 0.60\n### Mostly automatic installation\n\n`$ react-native link @react-native-picker/picker`\n\n### Manual installation\n\n\n#### iOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ ` @react-native-picker/picker` and add `RNCPicker.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNCPicker.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)\u003c\n\n#### Android\n\n1. Open **application** file (`android/app/src/main/java/[...]/MainApplication.java`)\n  - Add `import com.reactnativecommunity.picker.RNCPickerPackage;` to the imports at the top of the file\n  - Add `new RNCPickerPackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':@react-native-picker_picker'\n  \tproject(':@react-native-picker_picker').projectDir = new File(rootProject.projectDir, \t'../node_modules/@react-native-picker/picker/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n      implementation project(path: ':@react-native-picker_picker')\n  \t```\n#### MacOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ ` @react-native-picker/picker` and add `RNCPicker.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNCPicker.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)\u003c\n\u003c/details\u003e\n\n## RTL Support\n\nyou need to add `android:supportsRtl=\"true\"` to `AndroidManifest.xml`\n```xml\n   \u003capplication\n      ...\n      android:supportsRtl=\"true\"\u003e\n```\n\n## Usage\n\nImport Picker from `@react-native-picker/picker`:\n\n```javascript\nimport {Picker} from '@react-native-picker/picker';\n```\n\nCreate state which will be used by the `Picker`:\n\n```javascript\nconst [selectedLanguage, setSelectedLanguage] = useState();\n```\n\nAdd `Picker` like this:\n\n```javascript\n\u003cPicker\n  selectedValue={selectedLanguage}\n  onValueChange={(itemValue, itemIndex) =\u003e\n    setSelectedLanguage(itemValue)\n  }\u003e\n  \u003cPicker.Item label=\"Java\" value=\"java\" /\u003e\n  \u003cPicker.Item label=\"JavaScript\" value=\"js\" /\u003e\n\u003c/Picker\u003e\n```\n\nIf you want to open/close picker programmatically on android (available from version 1.16.0+), pass ref to `Picker`:\n\n```javascript\nconst pickerRef = useRef();\n\nfunction open() {\n  pickerRef.current.focus();\n}\n\nfunction close() {\n  pickerRef.current.blur();\n}\n\nreturn \u003cPicker\n  ref={pickerRef}\n  selectedValue={selectedLanguage}\n  onValueChange={(itemValue, itemIndex) =\u003e\n    setSelectedLanguage(itemValue)\n  }\u003e\n  \u003cPicker.Item label=\"Java\" value=\"java\" /\u003e\n  \u003cPicker.Item label=\"JavaScript\" value=\"js\" /\u003e\n\u003c/Picker\u003e\n```\n\n### Props\n\n* [Inherited `View` props...](https://reactnative.dev/docs/view#props)\n\n- [`onValueChange`](#onvaluechange)\n- [`selectedValue`](#selectedvalue)\n- [`style`](#style)\n- [`testID`](#testid)\n- [`enabled`](#enabled)\n- [`mode`](#mode)\n- [`prompt`](#prompt)\n- [`itemStyle`](#itemstyle)\n- [`selectionColor`](#selectionColor)\n\n---\n\n# Reference\n\n## Props\n\n### `onValueChange`\n\nCallback for when an item is selected. This is called with the following parameters:\n\n* `itemValue`: the `value` prop of the item that was selected\n* `itemPosition`: the index of the selected item in this picker\n\n| Type     | Required |\n| -------- | -------- |\n| function | No       |\n\n---\n\n### `selectedValue`\n\nValue matching value of one of the items. Can be a string or an integer.\n\n| Type | Required |\n| ---- | -------- |\n| any  | No       |\n\n---\n\n### `style`\n\n| Type            | Required |\n| --------------- | -------- |\n| pickerStyleType | No       |\n\n---\n\n### `testID`\n\nUsed to locate this view in end-to-end tests.\n\n| Type   | Required |\n| ------ | -------- |\n| string | No       |\n\n---\n\n### `enabled`\n\nIf set to false, the picker will be disabled, i.e. the user will not be able to make a selection.\n\n| Type | Required | Platform |\n| ---- | -------- | -------- |\n| bool | No       | Android, Web,  Windows  |\n\n---\n\n### `mode`\n\nOn Android, specifies how to display the selection items when the user taps on the picker:\n\n* 'dialog': Show a modal dialog. This is the default.\n* 'dropdown': Shows a dropdown anchored to the picker view\n\n| Type                       | Required | Platform |\n| -------------------------- | -------- | -------- |\n| enum('dialog', 'dropdown') | No       | Android  |\n\n---\n\n### `dropdownIconColor`\n\nOn Android, specifies color of dropdown triangle. Input value should be value that is accepted by react-native `processColor` function.\n\n| Type       | Required | Platform |\n| ---------- | -------- | -------- |\n| ColorValue | No       | Android  |\n\n---\n\n### `dropdownIconRippleColor`\n\nOn Android, specifies ripple color of dropdown triangle. Input value should be value that is accepted by react-native `processColor` function.\n\n| Type       | Required | Platform |\n| ---------- | -------- | -------- |\n| ColorValue | No       | Android  |\n\n---\n\n### `prompt`\n\nPrompt string for this picker, used on Android in dialog mode as the title of the dialog.\n\n| Type   | Required | Platform |\n| ------ | -------- | -------- |\n| string | No       | Android  |\n\n---\n\n### `itemStyle`\n\nStyle to apply to each of the item labels.\n\n| Type                               | Required | Platform |\n| ---------------------------------- | -------- | -------- |\n| [text styles](https://reactnative.dev/docs/text-style-props) | No       | iOS, Windows      |\n\n### `numberOfLines`\n\nOn Android \u0026 iOS, used to truncate the text with an ellipsis after computing the text layout, including line wrapping,\nsuch that the total number of lines does not exceed this number. Default is '1'\n\n| Type    | Required | Platform |\n| ------- | -------- | -------- |\n| number  | No       | Android, iOS  |\n\n### `onBlur`\n\n| Type      | Required | Platform |\n| --------- | -------- | -------- |\n| function  | No       | Android  |\n\n### `onFocus`\n\n| Type      | Required | Platform |\n| --------- | -------- | -------- |\n| function  | No       | Android  |\n\n### `selectionColor`\n\n| Type      | Required | Platform |\n| ------- | -------- | -------- |\n| ColorValue  | No       | iOS  |\n\n## Methods\n\n### `blur` (Android only, lib version 1.16.0+)\n\nProgrammatically closes picker\n\n### `focus` (Android only, lib version 1.16.0+)\n\nProgrammatically opens picker\n\n## PickerItemProps\n\nProps that can be applied to individual `Picker.Item`\n\n### `label`\n\nDisplayed value on the Picker Item\n\n| Type    | Required | \n| ------- | -------- | \n| string  | Yes      | \n\n\n### `value`\n\nActual value on the Picker Item\n\n| Type    | Required |\n| ------- | -------- |\n| number,string | Yes     |\n\n### `color`\n\nDisplayed color on the Picker Item\n\n| Type        | Required | \n| ----------- | -------- | \n| ColorValue  | No       | \n\n\n### `fontFamily`\n\nDisplayed fontFamily on the Picker Item\n\n| Type    | Required |\n| ------- | -------- |\n| string  | No      | \n\n\n### `style`\n\nStyle to apply to individual item labels.\n\n| Type    | Required | Platform |\n| ------- | -------- | -------- |\n| ViewStyleProp  | No       | Android  |\n\n\n### `enabled`\n\nIf set to false, the specific item will be disabled, i.e. the user will not be able to make a selection\n\n@default: true\n\n| Type    | Required | Platform |\n| ------- | -------- | -------- |\n| boolean  | No       | Android  |\n\n\n### `contentDescription`\n\nSets the content description to the Picker Item\n\n| Type   | Required | Platform |\n| ------ | -------- | -------- |\n| string | No       | Android  |\n\n\n### PickerIOS\n### Props\n\n- [Inherited `View` props...](https://reactnative.dev/docs/view#props)\n- [`itemStyle`](#itemstyle)\n- [`onValueChange`](#onvaluechange)\n- [`selectedValue`](#selectedvalue)\n- [`selectionColor`](#selectionColor)\n- [`themeVariant`](#themeVariant)\n\n---\n\n# Reference\n\n## Props\n\n### `itemStyle`\n\n| Type                               | Required |\n| ---------------------------------- | -------- |\n| [text styles](https://reactnative.dev/docs/text-style-props) | No       |\n\n---\n\n### `onValueChange`\n\n| Type     | Required |\n| -------- | -------- |\n| function | No       |\n\n---\n\n### `selectedValue`\n\n| Type | Required |\n| ---- | -------- |\n| any  | No       |\n\n---\n\n### `selectionColor`\n\n| Type      | Required | Platform |\n| ------- | -------- | -------- |\n| ColorValue  | No       | iOS  |\n\n---\n\n### `themeVariant`\n\n| Type | Required |\n| ---- | -------- |\n|  enum('light', 'dark')  | No       |\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-native-picker%2Fpicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freact-native-picker%2Fpicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-native-picker%2Fpicker/lists"}