1.6.0 • Published 2 months ago

react-native-calendar-range-picker v1.6.0

Weekly downloads
26
License
MIT
Repository
github
Last release
2 months ago

:point_up_2: react-native-calendar-range-picker

platforms npm npm

A Simple react native calendar picker using Hooks.

demo-play

Install

yarn add react-native-calendar-range-picker

or

npm install react-native-calendar-range-picker --save

Usage

Select date range

import Calendar from "react-native-calendar-range-picker";

<View style={{ flex: 1 }}>
  <Calendar
    startDate="2024-03-05"
    endDate="2024-03-12"
    onChange={({ startDate, endDate }) => console.log({ startDate, endDate })}
  />
</View>;

Select single date

<View style={{ height: 600 }}>
  <Calendar
    startDate="2024-03-05"
    singleSelectMode
    onChange={(date) => console.log(date)}
  />
</View>

Props

Common props you may want to specify include:

PropertiesPropTypeDescription
onChangefunc(Required) Handler which gets executed on day press including date data.(start, end or single date)
singleSelectModebooleanOnly select single date. (default = false)
pastYearRangenumberAmount of months allowed to scroll to the past. (default = 1)
futureYearRangenumberAmount of months allowed to scroll to the future. (default = 2)
localeobjectCan be localized by adding custom locales to locale object.
startDatestring(YYYY-MM-DD)Initially visible start date.
endDatestring(YYYY-MM-DD)Initially visible end date.
initialNumToRendernumberFlatList initialNumToRender prop.(to protect slow initial render)(default = 7)
flatListPropsFlatList PropsFlatList all props.
isMonthFirstbooleanSwitch year and month order. (2024 April -> April 2024)
disabledBeforeTodaybooleanDisable select day before today.
disabledAfterTodaybooleanDisable select day after today.
styleobjectCustomize style.

Locale

const CUSTOM_LOCALE = {
    monthNames: [
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December',
    ],
    dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
    today: 'Today',
    year: '', // letter behind year number -> 2024{year}
  }

<Calendar
  locale={CUSTOM_LOCALE}
  ...
/>;

Customize Style

<Calendar
  style={{
    container: {},
    monthContainer: {},
    monthOverlayContainer: {},
    weekContainer:{},
    monthNameText: {},
    dayNameText: {},
    dayText: {},
    dayTextColor: '#f7f7f7',
    holidayColor: 'rgba(0,0,0,0.5)',
    todayColor: 'blue',
    disabledTextColor: '#Hex',
    selectedDayTextColor: '#Hex',
    selectedDayBackgroundColor: '#Hex',
    selectedBetweenDayTextColor: '#Hex',
    selectedBetweenDayBackgroundTextColor: '#Hex',
  }}
  ...
/>;

License

MIT

1.6.0

2 months ago

1.5.8

6 months ago

1.5.7

6 months ago

1.5.5

8 months ago

1.5.4

8 months ago

1.5.6

8 months ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.4.6

3 years ago

1.5.0

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.3.7

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago