0.0.19 • Published 1 year ago

@optisolbusiness/react-native-calendar-component v0.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-calendar-component

@optisolbusiness/react-native-calendar-component

Installation

npm i @optisolbusiness/react-native-calendar-component

Usage

import { CalendarComponent } from '@optisolbusiness/react-native-calendar-component';

// ...

<CalendarComponent/>;

CalendarPicker Props

PropTypeDescription
weekdaysArrayOptional. List of week days. Eg. ['Mon', 'Tue', ...] Must be 7 days
monthsArrayOptional. List of months names. Eg. ['Jan', 'Feb', ...] Must be 12 months
firstDayNumberOptional. Default first day of week will be Sunday. You can set start of week with number from 0 to 6. Default is 0 or Sunday
startFromMondayBooleanOptional. Default first day of week will be Sunday. You can set start of week from Monday by setting this to true. Default is false
showDayStragglersBooleanOptional. Populate previous & next month days in empty slots. Default is false
allowRangeSelectionBooleanOptional. Allow to select date ranges. Default is false
allowBackwardRangeSelectBooleanOptional. Allow selecting range in reverse. Default is false
previousTitleStringOptional. Title of button for previous month. Default is Previous
nextTitleStringOptional. Title of button for next month. Default is Next
previousTitleStyleTextStyleOptional. Text styling for Previous text.
nextTitleStyleTextStyleOptional. Text styling for Next text.
previousComponentObjectOptional. Component to use in Previous button. Overrides previousTitle & previousTitleStyle.
nextComponentObjectOptional. Component to use in Next button. Overrides nextTitle & nextTitleStyle.
selectedDayColorStringOptional. Color for selected day
selectedDayStyleViewStyleOptional. Style for selected day. May override selectedDayColor.
selectedDayTextColorStringOptional. Text color for selected day
selectedDayTextStyleObjectOptional. Text style for selected day (including all days in range)
selectedRangeStartTextStyleObjectOptional. Text style for start day of range
selectedRangeEndTextStyleObjectOptional. Text style for end day of range
selectedRangeStartStyleViewStyleOptional. Container style for start day of range.
selectedRangeEndStyleViewStyleOptional. Container style for end day of range.
selectedRangeStyleViewStyleOptional. Container style for all days in range selection.
selectedDisabledDatesTextStyleObjectOptional. Text style for ineligible dates during range selection.
disabledDatesArray or FunctionOptional. Specifies dates that cannot be selected. Array of Dates, or a function that returns true for a given Moment date (apologies for the inverted logic).
disabledDatesTextStyleTextStyleOptional. Text styling for disabled dates.
selectedStartDateDateOptional. Specifies a selected Start Date.
selectedEndDateDateOptional. Specifies a selected End Date.
minRangeDurationNumber or ArrayOptional. Specifies a minimum range duration when using allowRangeSelection. Can either pass a number to be used for all dates or an Array of objects if the minimum range duration depends on the date {date: Moment-parsable date, minDuration: Number}
maxRangeDurationNumber or ArrayOptional. Specifies a maximum range duration when using allowRangeSelection. Can either pass a number to be used for all dates or an Array of objects if the maximum range duration depends on the date {date: Moment-parsable date, maxDuration: Number}
todayBackgroundColorStringOptional. Background color for today. Default is #cccccc
todayTextStyleTextStyleOptional. Text styling for today.
textStyleTextStyleOptional. Style overall text. Change fontFamily, color, etc.
customDatesStylesArray or FuncOptional. Style individual date(s). Supports an array of objects {date: Moment-parseable date, containerStyle: ViewStyle, style: ViewStyle, textStyle: TextStyle, allowDisabled: Boolean}, or a callback which receives a date param and returns {containerStyle: ViewStyle, style: ViewStyle, textStyle: TextStyle, allowDisabled: Boolean} for that date.
customDayHeaderStylesFuncOptional. Style day of week header (Monday - Sunday). Callback that receives ISO {dayOfWeek, month, year} and should return {style: ViewStyle, textStyle: TextStyle}
scaleFactorNumberOptional. Default (375) scales to window width
minDateDateOptional. Specifies minimum date to be selected
maxDateDateOptional. Specifies maximum date to be selected
initialDateDateOptional. Date that calendar opens to. Defaults to today.
widthNumberOptional. Width of CalendarPicker's container. Defaults to Dimensions width.
heightNumberOptional. Height of CalendarPicker's container. Defaults to Dimensions height.
scrollableBooleanOptional. Months are scrollable if true. Default is false
horizontalBooleanOptional. Scroll axis when scrollable set. Default is true
enableDateChangeBooleanOptional. Whether to enable pressing on day. Default is true
restrictMonthNavigationBooleanOptional. Whether to disable Previous month button if it is before minDate or Next month button if it is after MaxDate. Default is false
onDateChangeFunctionOptional. Callback when a date is selected. Returns Moment date as first param; START_DATE or END_DATE as second param.
onMonthChangeFunctionOptional. Callback when Previous / Next month is pressed. Returns Moment date as first parameter.
dayShapeStringOptional. Shape of the Day component. Default is circle. Available options are circle and square.
headingLevelNumberOptional. Sets the aria-level for the calendar title heading when on Web. Default is 1.
selectMonthTitleStringOptional. Title of month selector view. Default is "Select Month in " + {year}.
selectYearTitleStringOptional. Title of year selector view. Default is "Select Year".
dayLabelsWrapperViewStyleOptional. Style for weekdays wrapper. E.g If you want to remove top and bottom divider line.
enableSwipeDeprecatedUse scrollable.
swipeConfigDeprecatedUse scrollable.
onSwipeDeprecatedUse onMonthChange.
dayOfWeekStylesDeprecatedUse customDatesStyles & customDayHeaderStyles callbacks to style individual dates, days of week, and/or header.
customDatesStylesPriorityDeprecatedUse customDatesStyles & customDayHeaderStyles callbacks to style individual dates, days of week, and/or header.
monthYearHeaderWrapperStyleViewStyleOptional. Style for header MonthYear title wrapper. E.g If you want to change the order of year and month.
headerWrapperStyleViewStyleOptional. Style for entire header controls wrapper. This contains the previous / next controls plus month & year.
monthTitleStyleTextStyleOptional. Text styling for header's month text.
yearTitleStyleTextStyleOptional. Text styling for header's year text.
initialViewStringOptional. The view that the calendar opens to. Default is days. Available options are years, months, and days.

Styles

Some styles will overwrite some won't. For instance:

  • If you provide textStyle with fontFamily and color, out of ranges dates will not apply your color, just fontFamily.

Order of precedence:

  • defaultColor => textStyle => selectedDayColor
  • defaultTodayBackgroundColor => todayBackgroundColor
  • defaultBackgroundColor => selectedDayColor
  • defaultTextStyles => textStyle => selectedDayTextColor

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.3

1 year ago

0.0.1

1 year ago