GithubHelp home page GithubHelp logo

jiaoxuebing2014 / react-native-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beefe/react-native-picker

0.0 2.0 0.0 314 KB

A Picker written in pure javascript for cross-platform support.

JavaScript 100.00%

react-native-picker's Introduction

react-native-picker

version dep

A Picker written in pure javascript for cross-platform support.

It was most likely an example of how to build a cross-platform Picker Component use react-native-picker-android.

Needs react-native >= 0.14.2

####Demo

ui

ui2

###Documentation

####Props

  • style style of picker
  • pickerBtnText string, tool bar's confirm btn text
  • pickerCancelBtnText string, tool bar's cancel ben text
  • pickerBtnStyle textStylePropType, tool bar's btn style
  • pickerToolBarStyle viewStylePropType, tool bar's style
  • pickerHeight number, height of picker
  • showDuration number, animation of picker
  • pickerTitle string, title of picker
  • pickerTitleStyle textStylePropType, style of title
  • pickerData array
  • selectedValue any
  • onPickerDone function
  • onPickerCancel function
  • onValueChange function

####Methods

  • toggle show or hide picker, default to be hiden

###Usage

####Step 1 - install

	npm install react-native-picker --save

####Step 2 - import and use in project

	import Picker from 'react-native-picker'
	
	<Picker
		pickerHeight={300}
		showDuration={300}
		pickerData={}//picker`s value List
		selectedValue={}//default to be selected value
		onPickerDone={}//when confirm your choice
	/>

###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: [1,2,3,4],
			b2: [5,6,7,8],
			b3: [9,10,12,12]
		}
		...
	};
	selectedValue = ['a', 'a1', 1];

react-native-picker's People

Contributors

cnjon avatar lzxhahaha avatar xwenliang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.