Socket
Book a DemoInstallSign in
Socket

react-native-picker-view

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-picker-view

Cross platform Picker component for IOS and Android

1.0.9
latest
Source
npmnpm
Version published
Weekly downloads
1
-88.89%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-picker-view

Getting started

$ npm install react-native-picker-view --save

Mostly automatic installation

$ react-native link react-native-picker-view

Manual installation

iOS

  • In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  • Go to node_modulesreact-native-picker-view and add SRSPickerView.xcodeproj
  • In XCode, in the project navigator, select your project. Add libSRSPickerView.a to your project's Build PhasesLink Binary With Libraries
  • Run your project (Cmd+R)<

Android

  • Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.surajit.rnpv.SRSPickerViewPackage; to the imports at the top of the file
  • Add new SRSPickerViewPackage() to the list returned by the getPackages() method
  • Append the following lines to android/settings.gradle:
    include ':react-native-picker-view'
    project(':react-native-picker-view').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-picker-view/android')
    
  • Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-picker-view')
    

Usage

import Picker from 'react-native-picker-view';

// TODO: What to do with the module?
<Picker
      values={["Kolkata","Delhi","Hydrabad","Banglore","Pune"]}
      selected={this.state.index}
      style={{width:100,height:200}}
      enableInput={false}
      onSelect={(value,index) => {
          console.log('onSelect', value, index);
          this.setState({index})
      }}
  />

Sample Output

AndroidIOS

props

values

Array of values. Array item must be of type string.

selected

It is the index of the item that needs to be selected in Picker view. It is a 0 based index. Index less than zero is not supported.

enableInput (Android Only)

It is a boolean flag that is determined whether to activate keyboard input in Picker view. This flag is used only for android.

onSelect

It is a callback function, which is called from the library when a selection is changed. Its signature is :--

(selectedValue, selectedIndex) => {
   //selectedValue is the value of the selected item.
   //selectedIndex is the index of the item. 
}

Keywords

NumberPicker

FAQs

Package last updated on 11 Oct 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.