1.0.0 • Published 2 years ago

@masoudltf/react-native-wheel-date-picker v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Native Wheel Date Picker 🗓️

This module provides a simple carousel date picker with support of gregorian and jalaali date.

The package is both Android and iOS compatible.

Installation

$ yarn add @masoudltf/react-native-wheel-date-picker

or

$ npm install @masoudltf/react-native-wheel-date-picker

This module used react-native-snap-carousel and moment-jalaali and linking is not required.

Usage

First, you need to import module in your component.

import {WheelDatePicker} from "react-native-wheel-date-picker";

Then you can use module, like this:

<WheelDatePicker ref={ref => this._wheelDatePicker = ref}
                 fromYear={2011}
                 toYear={2021}
                 locale={'en'}
                 defaultDate={{year: 2021, month: 12, day: 15}}
                 calendarType={'gregorian'}/>

Properties

All properties are optional.

ParamTypeDefaultDescription
calendarTypeStringgregorianTwo type of calendars ('gregorian' or 'jalaali') are supported.
localeStringenDisplay numbers and month names in english or persian.
defaultDateObjectCurrent DateDepends on calendar type, default selected date is current gregorian or jalaali date.You can set this property like this: {year: 2021, month: 12, day: 15}
toYearNumberCurrent yearMaximum selectable year.
fromYearNumber10 years less than toYearMinimum selectable year.
rowHeightNumber50Height of the picker rows.
numberOfRowsNumber3Number of the visible picker rows.
onDateChangeFunctionundefinedFired when any change happens in date picker. Selected date is available in method.onDateChange = (selectedDate) => {}
textStylesObjectundefinedCustom style for texts.

Methods

MethodReturn TypeSampleDescription
getSelectedDateObject{year: '2021', month: '12', day: '15'}Returns selected date in gregorian