Skip to main content

WeekView props

events

(required).

Events to display, in Event Item format. See details in EventItem docs.

typearray of EventItem

selectedDate

(required).

Date to show the week-view in the first render.

typeDate
Note

Changing this prop after the first render will not have any effect in the week-view. To actually move the week-view, use the goToDate() method, for details see navigating guide.

numberOfDays

(required).

Number of days to show in one page.

type1 | 3 | 5 | 7

Styles and formats

headerStyle

Custom styles for header container. Example: { backgroundColor: '#4286f4', color: '#fff', borderColor: '#fff' }

typeobject
defaultnull

headerTextStyle

Custom styles for text inside header. Applied to day names and month name (i.e. title).

typeobject
default{ fontSize: 12, color: 'black' }

hourTextStyle

Custom styles for text displaying hours at the left.

typeobject
default{ fontSize: 12, color: 'black' }

hourContainerStyle

Custom styles for the container showing hours at the left.

typeobject
defaultnull

eventContainerStyle

Custom styles for each event item container. Note: the background color and (absolute) positioning are already set.

typeobject
default{ alignItems: 'center', borderRadius: 0 }

eventTextStyle

Custom styles for the event text. Ignored if EventComponent is provided.

typeobject
default{ color: '#fff', textAlign: 'center', fontSize: 15, marginVertical: 8, marginHorizontal: 2 }

allDayEventContainerStyle

Custom styles for each all-day event container. Note: the background color and (absolute) positioning are already set.

typeobject
defaultnull

gridRowStyle

Prop to customize width and color of horizontal lines.

type{ borderTopWidth: <width>, borderColor: <color> }
default{ borderTopWidth: 1, color: '#E9EDF0' }

gridColumnStyle

Prop to customize width and color of vertical lines.

type{ borderLeftWidth: <width>, borderColor: <color> }
default{ borderLeftWidth: 1, color: '#E9EDF0' }

formatDateHeader

Formatter for dates in the header. See all formatters in momentjs.

typestring
default'MMM D' (e.g. 'Apr 3')

formatTimeLabel

Formatter for the time labels at the left. Other examples, AM/PM: "h:mm A" or "h:mm a" for lowercase. See all formatters in momentjs.

typestring
defaultH:mm (24h)

Custom components

EventComponent

Custom component rendered inside an event. By default, is a Text with the event.description. See custom component guide for an example.

typeReactComponent
defaultText

AllDayEventComponent

Custom component rendered inside an all-day event. By default, is a Text with the event.description.

typeReactComponent
default<Text numberOfLines={1} ellipsizeMode='tail'/>

TodayHeaderComponent

Custom component to highlight today in the header (by default, today looks the same than every day). See custom component guide for an example.

typeReactComponent
defaultnull

DayHeaderComponent

Custom component to show each day in the header. If provided, overrides TodayHeaderComponent. See custom component guide for an example.

typeReactComponent
defaultnull

RefreshComponent

Custom component used when isRefreshing is true. See custom component guide for an example

typeReactComponent
defaultActivityIndicator

Day pages configuration

pageStartAt

Indicates what date to show in the top-left corner. If left: value provided, the selectedDate will appear at value days from the left. If weekday: value (e.g. tuesday = 2) is provided, the latest tuesday will appear in the left.

type{left: number, weekday: number}
default{left:0}

allowScrollByDay

When true, the component can scroll horizontally one day at the time. When false, the horizontal scroll can only be done one page at the time (i.e. numberOfDays at the time).

typebool
defaultfalse

Time of day configurations

startHour

Vertical position of the week-view in the first render (vertically in the agenda).

typenumber (hours)
default8 am

hoursInDisplay

Amount of hours to display vertically in the agenda. Increasing this number will make the events look smaller.

typenumber (hours)
default6

beginAgendaAt

Time of day to start the agenda at the top (grid above is left out). For example, for 8 am set beginAgendaAt={8*60}.

typenumber (minutes)
default0

endAgendaAt

Time of day to end the agenda at the bottom (anything past that time is left out). For example, set engAgendaAt={22*60} for 10pm.

typenumber (minutes)
default24*60

timeStep

Number of minutes to use as step in the time labels at the left. Increasing this number will increase the vertical space between grid lines.

typenumber (minutes)
default60

More configurations

enableVerticalPinch

Whether or not to enable vertical pinch gesture.

typeboolean
defaultfalse

showNowLine

If true, displays a line indicating the time right now.

typeboolean
defaultfalse

nowLineColor

Color used for the now-line.

typestring
default#E53935 (red)

showTitle

Show or hide the selected month and year in the top-left corner (a.k.a the title).

typebool
defaulttrue

timesColumnWidth

Customize the width of the times column at the left. If the value is in range 0..1 indicates a percentage of the screen width (e.g. 0.18 --> 18%). Otherwise is the amount of pixels (e.g. 40 pixels).

typenumber
default0.18 (18% of screen-width)

locale

Locale for the dates (e.g. header). There's an addLocale() function to add your own locale, see details in the localization guide.

typestring
defaulten

fixedHorizontally

If true, the component cannot scroll horizontally.

typeboolean
defaultfalse

isRefreshing

When true, the week-view will show an <ActivityIndicator /> in the middle of the grid.

typeboolean
defaultfalse

rightToLeft

If true, render older days to the right and more recent days to the left.

typeboolean
defaultfalse

Press callbacks

onEventPress

Callback when an event item is pressed, receives the event-item pressed: (event) => {}.

typefunction

onEventLongPress

Callback when an event item is long pressed, same signature as onEventPress. Signature: (event) => {}

typefunction
defaultnull

onGridClick

Callback when the grid view is pressed. Arguments: pressEvent: object passed by the react-native-gesture-handler touch events (not an event item); startHour: Number, hour pressed; date Date, date object indicating day and time pressed with precision up to seconds. Note: startHour is redundant (can be extracted from date), but is kept for backward-compatibility. Signature: (pressEvent, startHour, date) => {}

typefunction
defaultnull

onGridLongPress

Callback when the grid view is long-pressed. Same signature as onGridClick Signature: (pressEvent, startHour, date) => {}

typefunction
defaultnull

onDayPress

Callback when a day from the header is pressed. Signature: (date, formattedDate) => {}

typefunction
defaultnull

onMonthPress

Callback when the month at the top left (title) is pressed. Signature: (date, formattedDate) => {}

typefunction
defaultnull

Scroll callbacks

onSwipeNext

Callback when week-view is swiped to next week/days, receives new date shown. Signature: (date) => {}

typefunction
defaultnull

onSwipePrev

Callback when week-view is swiped to previous week/days, same signature as onSwipeNext. Signature: (date) => {}

typefunction
defaultnull

onTimeScrolled

Callback when the agenda is scrolled vertically. Signature: (dateWithTime) => {}

typefunction
defaultnull

Drag props

onDragEvent

Callback when an event item is dragged to another position. Arguments: event: event-item moved, and the newStartDate and newEndDate are Date objects with day and hour of the new position (precision up to minutes). With this callback you must trigger an update on the events prop (i.e. update your DB), with the updated information from the event. Signature: (event, newStartDate, newEndDate) => update DB

typefunction
defaultnull

dragEventConfig

If provided, events are only draggable after being long pressed for some time. Requires rn-gesture-handler v2.6.0 or higher. Disables the onLongPress callback.

type{afterLongPressDuration: milliseconds}
default{afterLongPressDuration: 0}

Edit props

onEditEvent

Callback when an event item is edited by dragging its borders. Signature: (event, newStartDate, newEndDate) => update DB.

typefunction
defaultnull

editingEvent

Event id indicating the event currently being edited.

typenumber | string
defaultnull

editEventConfig

Sides allowed to be edited.

type{ bottom: bool, top: bool, left: bool, right: bool }
default{ bottom: true }

Horizontal list optimizations

windowSize

Number of pages to render at the same time. One page is composed by numberOfDays days. See in optimizing FlatList docs

typenumber
default5

initialNumToRender

Initial number of pages to render. See in optimizing FlatList docs

typenumber
default5

maxToRenderPerBatch

typenumber
default2

updateCellsBatchingPeriod

typenumber
default50

Patch props

prependMostRecent

If true, the horizontal prepending is done in the most recent dates when scrolling. See known issues.

typebool
defaultfalse

runOnJS

Passed to react-native-gesture-handler. Might be needed to prevent an ANR bug in android, see details in [this issue](this issue)

typebool
defaultfalse