Skip to content

Repository files navigation

🎯 Try component at snack.expo.io

npm type definitionsnpm type definitionsnpm bundle size

React Native customizable date picker component for iOS and Android. Designed using ScrollView. Looks identical on all devices.

💻 Example

component-gif-preview

💬 Installation

1. Add dependency to the project

$ yarn add @dietime/react-native-date-picker
$ npm install @dietime/react-native-date-picker --save

2. Import dependency

importDatePickerfrom'@dietime/react-native-date-picker';

👩‍💻 Usage

importReact,{useState}from"react";import{Text,View}from"react-native";importDatePickerfrom"@dietime/react-native-date-picker";exportdefaultfunctionApp(){const[date,setDate]=useState();return(<View><Text>{date ? date.toDateString() : "Select date..."}</Text><DatePickervalue={date}onChange={(value)=>setDate(value)}format="yyyy-mm-dd"/></View>);}

📚 Documentation

PropRequiredTypeDescription
valueDate or null or undefinedInitial date for component
onChange(value: Date) : voidCallback on date change event
heightnumberCustom component height
widthnumber or stringCustom component width such as 100 or '50%'
fontSizenumberCustom digits font size
textColorstringCustom digits text color such as hex, rgb or rgba
endYearnumberMax year in component, default is current year
startYearnumberMin year in component, default is endYear - 100
markColorstringCustom middle mark color such as hex, rgb or rgba
markHeightnumberCustom height of middle mark
markWidthnumber or stringCustom width of middle mark such as 100 or '50%'
fadeColorstringCustom color for top and bottom fade effect only hex colors!
formatstringCustom picker format like reshuffle of yyyy, mm, dd. Example: 'yyyy-mm-dd' or 'dd-mm-yyyy' and other

📃 License

Copyright 2023 Denis Glazkov glazzk.off@mail.ru

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

React Native customizable date picker component for iOS and Android. Designed using ScrollView.

Topics

Resources

Stars

60 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages