@react-native-picker/picker vs react-native-dropdown-picker
React Native Picker Libraries Comparison
1 Year
@react-native-picker/pickerreact-native-dropdown-pickerSimilar Packages:
What's React Native Picker Libraries?

Both @react-native-picker/picker and react-native-dropdown-picker are libraries designed to provide dropdown selection functionality in React Native applications. They allow users to select an option from a list, enhancing the user interface and experience. While both serve a similar purpose, they differ in features, customization options, and ease of use, catering to different developer needs and preferences.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
@react-native-picker/picker531,8401,601399 kB2222 months agoMIT
react-native-dropdown-picker74,8671,015161 kB1642 years agoMIT
Feature Comparison: @react-native-picker/picker vs react-native-dropdown-picker

Customization Options

  • @react-native-picker/picker:

    @react-native-picker/picker offers basic customization options, allowing developers to style the picker using standard React Native styles. It supports custom item rendering, but the overall design is relatively straightforward and may require additional work for complex designs.

  • react-native-dropdown-picker:

    react-native-dropdown-picker provides extensive customization options, including customizable dropdown styles, item rendering, and animations. Developers can easily modify the appearance and behavior of the dropdown to fit their application's design requirements.

Multi-Select Support

  • @react-native-picker/picker:

    @react-native-picker/picker does not support multi-select functionality natively. It is designed for single selection, making it less suitable for scenarios where users need to select multiple items from a list.

  • react-native-dropdown-picker:

    react-native-dropdown-picker supports multi-select, allowing users to select multiple items from the dropdown. This feature is particularly useful in applications where users need to make several selections at once, enhancing usability.

Search Functionality

  • @react-native-picker/picker:

    @react-native-picker/picker does not include built-in search functionality. For large datasets, developers may need to implement their own search mechanism to filter options, which can add complexity to the implementation.

  • react-native-dropdown-picker:

    react-native-dropdown-picker includes built-in search functionality, enabling users to quickly find options in long lists. This feature significantly improves user experience, especially when dealing with extensive datasets.

Performance

  • @react-native-picker/picker:

    @react-native-picker/picker is lightweight and optimized for performance, making it suitable for applications where performance is critical. It has a minimal footprint and is less likely to introduce performance bottlenecks.

  • react-native-dropdown-picker:

    react-native-dropdown-picker, while feature-rich, may have a slightly larger performance overhead due to its additional functionalities. However, it is still optimized for performance and should perform well in most scenarios.

Community Support and Maintenance

  • @react-native-picker/picker:

    @react-native-picker/picker is part of the React Native community and is actively maintained. It has a solid user base and receives regular updates, ensuring compatibility with the latest React Native versions.

  • react-native-dropdown-picker:

    react-native-dropdown-picker also has a strong community and is actively maintained. It benefits from user contributions and feedback, leading to continuous improvements and feature enhancements.

How to Choose: @react-native-picker/picker vs react-native-dropdown-picker
  • @react-native-picker/picker:

    Choose @react-native-picker/picker if you need a simple, lightweight, and customizable picker component that integrates well with the React Native ecosystem. It is ideal for applications that require basic dropdown functionality without extensive additional features.

  • react-native-dropdown-picker:

    Choose react-native-dropdown-picker if you require a more feature-rich dropdown component that supports multi-select, search functionality, and customizable styles. It is suitable for applications that need advanced dropdown capabilities and a more interactive user experience.

README for @react-native-picker/picker

@react-native-picker/picker

npm version Build Supports Android, iOS, MacOS, and Windows MIT License Lean Core Extracted

| Android | iOS | PickerIOS | | --- | --- | --- | | | |

| Windows | MacOS | | --- | --- | | |

Supported Versions

| @react-native-picker/picker | react-native | react-native-windows | | --- | --- | --- | | >= 2.0.0 | 0.61+ | 0.64+ | | >= 1.16.0 | 0.61+ | 0.61+ | | >= 1.2.0 | 0.60+ or 0.59+ with Jetifier | N/A | | >= 1.0.0 | 0.57 | N/A |

Getting started

$ npm install @react-native-picker/picker --save

or

$ yarn add @react-native-picker/picker

For React Native v0.60 and above (Autolinking)

As react-native@0.60 and above supports autolinking there is no need to run the linking process. Read more about autolinking here. This is supported by react-native-windows@0.64 and above.

iOS

CocoaPods on iOS needs this extra step:

npx pod-install

Android

No additional step is required.

Windows (expand for details)

Windows

Usage in Windows without autolinking requires the following extra steps:

Add the ReactNativePicker project to your solution.
  1. Open the solution in Visual Studio 2019
  2. Right-click Solution icon in Solution Explorer > Add > Existing Project Select D:\dev\RNTest\node_modules\@react-native-picker\picker\windows\ReactNativePicker\ReactNativePicker.vcxproj
windows/myapp.sln

Add a reference to ReactNativePicker to your main application project. From Visual Studio 2019:

Right-click main application project > Add > Reference... Check ReactNativePicker from Solution Projects.

app.cpp

Add #include "winrt/ReactNativePicker.h" to the headers included at the top of the file.

Add PackageProviders().Append(winrt::ReactNativePicker::ReactPackageProvider()); before InitializeComponent();.

MacOS

CocoaPods on MacOS needs this extra step (called from the MacOS directory)

pod install
React Native below 0.60 (Link and Manual Installation)

The following steps are only necessary if you are working with a version of React Native lower than 0.60

Mostly automatic installation

$ react-native link @react-native-picker/picker

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modules @react-native-picker/picker and add RNCPicker.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNCPicker.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open application file (android/app/src/main/java/[...]/MainApplication.java)
  • Add import com.reactnativecommunity.picker.RNCPickerPackage; to the imports at the top of the file
  • Add new RNCPickerPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':@react-native-picker_picker'
    project(':@react-native-picker_picker').projectDir = new File(rootProject.projectDir, 	'../node_modules/@react-native-picker/picker/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      implementation project(path: ':@react-native-picker_picker')
    

MacOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modules @react-native-picker/picker and add RNCPicker.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNCPicker.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

RTL Support

you need to add android:supportsRtl="true" to AndroidManifest.xml

   <application
      ...
      android:supportsRtl="true">

Usage

Import Picker from @react-native-picker/picker:

import {Picker} from '@react-native-picker/picker';

Create state which will be used by the Picker:

const [selectedLanguage, setSelectedLanguage] = useState();

Add Picker like this:

<Picker
  selectedValue={selectedLanguage}
  onValueChange={(itemValue, itemIndex) =>
    setSelectedLanguage(itemValue)
  }>
  <Picker.Item label="Java" value="java" />
  <Picker.Item label="JavaScript" value="js" />
</Picker>

If you want to open/close picker programmatically on android (available from version 1.16.0+), pass ref to Picker:

const pickerRef = useRef();

function open() {
  pickerRef.current.focus();
}

function close() {
  pickerRef.current.blur();
}

return <Picker
  ref={pickerRef}
  selectedValue={selectedLanguage}
  onValueChange={(itemValue, itemIndex) =>
    setSelectedLanguage(itemValue)
  }>
  <Picker.Item label="Java" value="java" />
  <Picker.Item label="JavaScript" value="js" />
</Picker>

Props


Reference

Props

onValueChange

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

| Type | Required | | -------- | -------- | | function | No |


selectedValue

Value matching value of one of the items. Can be a string or an integer.

| Type | Required | | ---- | -------- | | any | No |


style

| Type | Required | | --------------- | -------- | | pickerStyleType | No |


testID

Used to locate this view in end-to-end tests.

| Type | Required | | ------ | -------- | | string | No |


enabled

If set to false, the picker will be disabled, i.e. the user will not be able to make a selection.

| Type | Required | Platform | | ---- | -------- | -------- | | bool | No | Android, Web, Windows |


mode

On Android, specifies how to display the selection items when the user taps on the picker:

  • 'dialog': Show a modal dialog. This is the default.
  • 'dropdown': Shows a dropdown anchored to the picker view

| Type | Required | Platform | | -------------------------- | -------- | -------- | | enum('dialog', 'dropdown') | No | Android |


dropdownIconColor

On Android, specifies color of dropdown triangle. Input value should be value that is accepted by react-native processColor function.

| Type | Required | Platform | | ---------- | -------- | -------- | | ColorValue | No | Android |


dropdownIconRippleColor

On Android, specifies ripple color of dropdown triangle. Input value should be value that is accepted by react-native processColor function.

| Type | Required | Platform | | ---------- | -------- | -------- | | ColorValue | No | Android |


prompt

Prompt string for this picker, used on Android in dialog mode as the title of the dialog.

| Type | Required | Platform | | ------ | -------- | -------- | | string | No | Android |


itemStyle

Style to apply to each of the item labels.

| Type | Required | Platform | | ---------------------------------- | -------- | -------- | | text styles | No | iOS, Windows |

numberOfLines

On Android & iOS, used to truncate the text with an ellipsis after computing the text layout, including line wrapping, such that the total number of lines does not exceed this number. Default is '1'

| Type | Required | Platform | | ------- | -------- | -------- | | number | No | Android, iOS |

onBlur

| Type | Required | Platform | | --------- | -------- | -------- | | function | No | Android |

onFocus

| Type | Required | Platform | | --------- | -------- | -------- | | function | No | Android |

selectionColor

| Type | Required | Platform | | ------- | -------- | -------- | | ColorValue | No | iOS |

Methods

blur (Android only, lib version 1.16.0+)

Programmatically closes picker

focus (Android only, lib version 1.16.0+)

Programmatically opens picker

PickerItemProps

Props that can be applied to individual Picker.Item

label

Displayed value on the Picker Item

| Type | Required | | ------- | -------- | | string | Yes |

value

Actual value on the Picker Item

| Type | Required | | ------- | -------- | | number,string | Yes |

color

Displayed color on the Picker Item

| Type | Required | | ----------- | -------- | | ColorValue | No |

fontFamily

Displayed fontFamily on the Picker Item

| Type | Required | | ------- | -------- | | string | No |

style

Style to apply to individual item labels.

| Type | Required | Platform | | ------- | -------- | -------- | | ViewStyleProp | No | Android |

enabled

If set to false, the specific item will be disabled, i.e. the user will not be able to make a selection

@default: true

| Type | Required | Platform | | ------- | -------- | -------- | | boolean | No | Android |

contentDescription

Sets the content description to the Picker Item

| Type | Required | Platform | | ------ | -------- | -------- | | string | No | Android |

PickerIOS

Props


Reference

Props

itemStyle

| Type | Required | | ---------------------------------- | -------- | | text styles | No |


onValueChange

| Type | Required | | -------- | -------- | | function | No |


selectedValue

| Type | Required | | ---- | -------- | | any | No |


selectionColor

| Type | Required | Platform | | ------- | -------- | -------- | | ColorValue | No | iOS |


themeVariant

| Type | Required | | ---- | -------- | | enum('light', 'dark') | No |