React Native DayView Calendar
DayView Calendar is a react-native
, themable, animated calendar that display carousel of days with possibility to add, remove or resize events.
Features
- Events are addable, removable, resizable and movable
- Carousel of days
- Themable
- Customisable
Getting started
Start by adding @uplet/react-native-dayview-calendar
as a dependency to your React Native project (use react-native init MyProject
to create one if you don't have a project):
yarn add @uplet/react-native-dayview-calendar
or
npm install @uplet/react-native-dayview-calendar
Documentation
Default component to use is<DaysCalendar />
Example
import DaysCalendar from "@uplet/react-native-dayview-calendar"
<DaysCalendar
date={'28-01-2019'}
disabledDates={() => {}}
dayStartShift={6}
dateRange={365}
interval={30}
events={(date: string) => {
...
}}
onDateChangeEvent={(date, { id }, startDate, endDate) => {
...
}}
onCreateEvent={(date, startDate, endDate) => {
...
}}
onDeleteEvent={(date, { id }) => {
...
}}
/>
Props
onCreateEvent
Callback that is triggered when event should be created
(date, startTime, endTime) => void;
onDateChangeEvent
Callback that is triggered when event changes it's date
(date, event, startTime, endTime) => void;
onDeleteEvent
Callback that is triggered when event should be deleted
(date, event) => void;
onDayChangeEvent
Callback that is triggered when active day changed
(day) => void;
date
Start Day, default is today
disabledDates
Function that returns disabled dates for given day;
day => Array<{startDate, endDate}>
events
Function that returns event dates for given day;
day => Array<{startDate, endDate}>
dateRange
How many days user will be able to swipe calendar. By default it's 365
windowSize
How many days out of the screen should be rendered in advance
calendarRecreateTreshold
Percentage of the calendar days. If there is less days left after scroll it forces re-create calendar with new date
theme
Set of styles properties that can customize the calendar appearance
{
accentColor,
accentBackgroundColor,
backgroundColor,
timeIndicator,
labelColor,
minuteSplitColor,
hourSplitColor,
disabledColor,
}
disablePast
Whether calendar should allow to swipe to the past
customStartPosition
Should scroll to current time on each day
customStartPositionOffset
custom offset for custom start postion
Publishing
First you need to have access to uplet organization on npm. Ask Harris for it.
Use one of the following yarn commands to publish package
yarn release
yarn release:next
yarn release:beta
Made with ❤️ at Uplet
DayView calendar is an open source project. If you like it, please star it 🌟.