You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

rc-react-native-picker

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-react-native-picker

[![npm version](https://img.shields.io/npm/v/react-native-picker.svg?style=flat-square)](https://www.npmjs.com/package/react-native-picker) <img src="https://david-dm.org/beefe/react-native-picker.s

4.0.18
latest
Source
npmnpm
Version published
Weekly downloads
15
-59.46%
Maintainers
1
Weekly downloads
 
Created
Source

rc-react-native-picker

npm version dependency status

Documentation

Params

KeyDescriptionTypeDefault
pickerConfirmBtnTextstringconfirm
pickerCancelBtnTextstringcancel
pickerTitleTextstringpls select
pickerConfirmBtnColorarray[1, 186, 245, 1]
pickerCancelBtnColorarray[1, 186, 245, 1]
pickerTitleColorarray[20, 20, 20, 1])
pickerToolBarBgarray[232, 232, 232, 1]
pickerBgarray[196, 199, 206, 1]
pickerToolBarFontSizenumber16
pickerFontSizenumber16
pickerFontColorarray[31, 31, 31, 1]
pickerDataarray
selectedValuestring
onPickerConfirmfunction
onPickerCancelfunction
onPickerSelectfunction

Methods

NameDescriptionTypeDefault
initinit and pass parameters to picker
toggleshow or hide picker
showshow picker
hidehide picker
selectselect a rowarray
isPickerShowget status of picker, return a boolean

Usage

Step 1 - install

	npm install rc-react-native-picker --save
	react-native link

Step 3 - import and use in project

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

	let data = [];
    for(var i=0;i<100;i++){
        data.push(i);
    }

    Picker.init({
        pickerData: data,
        selectedValue: [59],
        onPickerConfirm: data => {
            console.log(data);
        },
        onPickerCancel: data => {
            console.log(data);
        },
        onPickerSelect: data => {
            console.log(data);
        }
    });
    Picker.show();
	

Notice

support two modes:

1. parallel: such as time picker, wheels have no connection with each other

2. cascade: such as date picker, address picker .etc, when front wheel changed, the behind wheels will all be reset

parallel:

  • single wheel:
	pickerData = [1,2,3,4];
	selectedValue = 3;
  • two or more wheel:
	pickerData = [
		[1,2,3,4],
		[5,6,7,8],
		...
	];
	selectedValue = [1, 5];

cascade:

  • two wheel
    pickerData = [
        {
            a: [1, 2, 3, 4]
        },
        {
            b: [5, 6, 7, 8]
        },
        ...
    ];
    selectedValue = ['a', 2];
  • three wheel
    pickerData = [
        {
            a: [
                {
                    a1: [1, 2, 3, 4]
                },
                {
                    a2: [5, 6, 7, 8]
                },
                {
                    a3: [9, 10, 11, 12]
                }
            ]
        },
        {
            b: [
                {
                    b1: [11, 22, 33, 44]
                },
                {
                    b2: [55, 66, 77, 88]
                },
                {
                    b3: [99, 1010, 1111, 1212]
                }
            ]
        },
        {
            c: [
                {
                    c1: ['a', 'b', 'c']
                },
                {
                    c2: ['aa', 'bb', 'cc']
                },
                {
                    c3: ['aaa', 'bbb', 'ccc']
                }
            ]
        },
        ...
    ]

FAQs

Package last updated on 01 Jun 2017

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