Skip to content

Repository files navigation

React Native Number Please 🙏🏽

BuildnpmnpmNPM

Generate react-native pickers with range numbers.

Example

runs with expo

ezgif-3-f565f85e890a

Installing

Add the package to your project

yarn add react-native-number-please
npm install -S react-native-number-please

Usage

importReactfrom"react";import{View,Text}from"react-native";importNumberPleasefrom"react-native-number-please";constOrderPizza=()=>{constinitialValues=[{id: "pizza",value: 3}];const[pizzas,setPizzas]=useState(initialValues);constpizzaNumbers=[{id: "pizza",label: "🍕",min: 0,max: 99}];return(<View><Text>I would like</Text><NumberPleasedigits={pizzaNumbers}values={pizzas}onChange={(values)=>setPizzas(values)}/></View>);};
importReactfrom"react";import{View,Text}from"react-native";importNumberPleasefrom"react-native-number-please";constItsYourBirthday=()=>{constinitialBirthday=[{id: "day",value: 16},{id: "month",value: 4},{id: "year",value: 1970},];const[birthday,setBirtday]=useState(initialBirthday);constdate=[{id: "day",label: "",min: 0,max: 31},{id: "month",label: "",min: 0,max: 12},{id: "year",label: "",min: 1900,max: newDate().getFullYear()},return(<View><Text>My birthday</Text><NumberPleasedigits={date}values={birthday}onChange={(values)=>setBirtday(values)}/></View>);};

Props

PropRequiredDescriptionDefaultTypes
digitsArray of objects containing individal picker configundefinedIDigit[]
valuesArray of objects initial values for each picker in digitsundefinedIValue[]
onChangeCallback for when an item is selected.undefined
pickerStyleOptionalPicker wrapper style object.{}
itemStyleOptionalPicker item style object.{}

Interfaces

interfaceIDigit{id: string;label?: string;min: number;max: number;}interfaceIValue{id: string;value: number;}

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

🔢 Generate react-native pickers with range numbers.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages