
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@react-native-community/picker
Advanced tools
@react-native-community/picker
Android | iOS | PickerIOS | Windows | MacOS |
---|---|---|---|---|
![]() | ![]() | ![]() | ![]() | ![]() |
@react-native-community/picker | react-native |
---|---|
>= 1.2.0 | 0.60+ or 0.59+ with Jetifier |
>= 1.0.0 | 0.57 |
This component is not supported in the managed workflow for expo sdk 37. Please import the Picker
from react-native
.
See more info here
$ npm install @react-native-community/picker --save
or
$ yarn add @react-native-community/picker
As react-native@0.60.0 or above supports autolinking, so there is no need to run linking process. Read more about autolinking here.
CocoaPods on iOS needs this extra step
npx pod-install
No additional step is required.
ReactNativePicker
project to your solution.D:\dev\RNTest\node_modules\@react-native-community\picker\windows\ReactNativePicker\ReactNativePicker.vcxproj
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.
Add #include "winrt/ReactNativePicker.h"
.
Add PackageProviders().Append(winrt::ReactNativePicker::ReactPackageProvider());
before InitializeComponent();
.
CocoaPods on MacOS needs this extra step (called from the MacOS directory)
pod install
$ react-native link @react-native-community/picker
Libraries
➜ Add Files to [your project's name]
node_modules
➜ @react-native-community/picker
and add RNCPicker.xcodeproj
libRNCPicker.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<android/app/src/main/java/[...]/MainApplication.java
)import com.reactnativecommunity.picker.RNCPickerPackage;
to the imports at the top of the filenew RNCPickerPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ': @react-native-community/picker'
project(': @react-native-community/picker').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/picker/android')
android/app/build.gradle
:
implementation project(path: ':@react-native-community_picker')
Libraries
➜ Add Files to [your project's name]
node_modules
➜ @react-native-community/picker
and add RNCPicker.xcodeproj
libRNCPicker.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<Renders the native picker component on iOS and Android. Example:
Import Picker from @react-native-community/picker
import {Picker} from '@react-native-community/picker';
Create state which will be used by the Picker
state = {
language: 'java',
};
Add Picker
like this:
<Picker
selectedValue={this.state.language}
style={{height: 50, width: 100}}
onValueChange={(itemValue, itemIndex) =>
this.setState({language: itemValue})
}>
<Picker.Item label="Java" value="java" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
onValueChange
Callback for when an item is selected. This is called with the following parameters:
itemValue
: the value
prop of the item that was selecteditemPosition
: the index of the selected item in this pickerType | 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, Windows |
mode
On Android, specifies how to display the selection items when the user taps on the picker:
Type | Required | Platform |
---|---|---|
enum('dialog', 'dropdown') | 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 |
itemStyle
Type | Required |
---|---|
text styles | No |
onValueChange
Type | Required |
---|---|
function | No |
selectedValue
Type | Required |
---|---|
any | No |
FAQs
React Native Picker for iOS & Android
The npm package @react-native-community/picker receives a total of 10,850 weekly downloads. As such, @react-native-community/picker popularity was classified as popular.
We found that @react-native-community/picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 40 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.