events(Array) - Events to displayonEventPress(Function) - Callback when event item is clickednumberOfDays(Number) - Set number of days to show in view, can be1,3,5,7.formatDateHeader(String) - Format for dates of header, default isMMM DselectedDate(Date) - Intial date to show week/days in viewonSwipeNext(Function) - Callback when calendar is swiped to next week/daysonSwipePrev(Function) - Callback when calendar is swiped to previous week/dayslocale(String) - locale for the header, there's aaddLocalefunction to add cusomized locale. Default isen.showTitle(Boolean) - show/hide the title (the selected month and year). Default istrue.headerStyle(Object) - custom styles for header container. Example:{ backgroundColor: '#4286f4', color: '#fff', borderColor: '#fff' }headerTextStyle(Object) - custom styles for text inside header. Includes day names and title (month)hourTextStyle(Object) - custom styles for text displaying hours in the left.eventContainerStyle(Object) - custom styles for the event container. Notice the background color and positioning (absolute) are already set.hoursInDisplay(Number) - Amount of hours to display in the screen. Default is 6.startHour(Number) - Hour to scroll to on start. Default is 8 (8 am).onGridClick(Function) - Callback when the grid view is clicked, signature:(pressEvent, startHour, date) => {}.pressEvent(Object) - object passed by the TouchableWithoutFeedback.onPress() method (and not an event object as defined below)startHour(Number) - hour clicked (as integer)date(Date) - date object indicating day clicked (the hour is not relevant)
EventComponent(React.Component) - Component rendered inside an event. By default, is aTextwith theevent.description. See below for details on the component.rightToLeft(Boolean) - If true, render older days to the right and more recent days to the left.prependMostRecent(Boolean) - If true, the horizontal prepending is done in the most recent dates. See issue #39 for more details. Default is false.
{
id: 1,
description: 'Event',
startDate: new Date(),
endDate: new Date(),
color: 'blue',
// ... more properties if needed,
}The component will be rendered inside a TouchableOpacity, which has the background color set to event.color, and is placed with absolute position in the grid. The component receives two props:
event(Event) - Event object as described before.position: (Object) - object containingtop,left,heightandwidthvalues in pixels.
For example, to display an icon inside each event, such as a react-native-elements Icon:
const MyEventComponent = ({ event, position }) => (
<Icon
name={event.iconName}
type={event.iconType}
color={event.color}
size={position.height}
/>
);
<WeekView
// ... other props
EventComponent={MyEventComponent}
/>There's a addLocale function to add customized locale for the component. The component depends on momentjs, you can refer to https://momentjs.com/docs/#/customization/ for more information.
Example:
export WeekView, { addLocale } from 'react-native-week-view';
// add customized localed before using locale prop.
addLocale('fr', {
months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
});
- allow to swipe between weeks or days.
- header should be swipeable with columns.
- allow to click on grid view.
- allow to drag drop events to specific time and date.
