1.2.0 • Published 5 years ago

rn-lightweight-date-picker v1.2.0

Weekly downloads
120
License
MIT
Repository
github
Last release
5 years ago

React Native Light DatePicker

install size dependencies Status Test Coverage Maintainability Build Status

Lightweight date range picker without dependencies for React Native.

Install

$ npm i rn-lightweight-date-picker --save

Example

  state = {
    minDate: new Date(2018, 12, 31)
  }

  onChange(data){
    const { start, end } = data;
    if(start && data) api.fetchSchedule(start, end);
  }
  
  render(){
    return(
      <Calendar
        locale = "ru"
        userStyles = {{ topBar: { controls: 'flex-start' }}}
        userColors = {{ title: 'blue' }}
        maxRange = {10}
        minDate = {this.state.minDate}
        onDateChange={this.onChange}
        format="dd.mm.yyyy"
      />
    )
  }

Contributing

Feel free to open new issues if you have any problems or suggestions.

Properties

All properties are optional

PropTypeDefaultDesc
localeStringDevice languageCalendar localization.
onDateChangeFunction(date) => {}Returns chosen date. Range mode: {start: value, end: value}, single: value. value: if date selected - Date object, if selected and format specified - String, if not selected - false.
formatString or falsefalseExample: "dddd. mmmm - yyyy". See below for details.
userColorsObject{}Override colors. See below for details.
userStylesObject{}Override styles. See below for details.
minRangeNumber or falsefalseMinimum avaliable size of selected range.
maxRangeNumber or falsefalseMaximum avaliable size of selected range.
minDateDate or falsefalseMinimum avaliable date to be selected. .
maxDateDate or falsefalseMaximum avaliable date to be selected.
modeStringrangesingle or range. Gives opportunity to select only one date or range(If range you can select one date too).
titleFadeDurationNumber300Title switching duration in ms.
swipeDurationNumber300Month switching duration in ms.
initialDateDatenew Date()This date will be shown in calendar on load. Default is Current Time.
showControlsBoolfalseSpecified if arrows controls are visible(doesnt disable swipes).
leftControlComponent<Text>{ "<" }</Text>Specified left control.
RightControlComponent<Text>{ ">" }</Text>Specified right control.
highlightTodayBooltrueSpecified if current date should be highlighted.
rowheightNumber30Week height in calendar.
rowPaddingNumber7Week padding in calendar.

Styles

All styles could be overwritten. If you want you can also easily change only colors. Below you can see what values are responsible for styles or colors, you can override them in userStyles or userColors.(Components are colorized just to facilitate understanding)

Date format

Example dd dddd mmmm : yyyy will become 01 Sunday September : 2019.

PropTypeDefaultDescDefaultDesc
dnTmnSyy19
d1-31m1-12yyyy2019
dd01-31mm01-12
dddThummmSep
ddddThursdaymmmmSeptember
1.3.0-beta.0

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago