Skip to content

riordanpawley/react-native-week-view

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-week-view

weekView

Props

  • events (Array) - Events to display
  • onEventPress (Function) - Callback when event item is clicked
  • numberOfDays (Number) - Set number of days to show in view, can be 1, 3, 7.
  • dateHeaderFormat (String) - Format for dates of header, default is MMM D
  • selectedDate (Date) - Intial date to show week/days in view
  • onSwipeNext (Function) - Callback when calendar is swiped to next week/days
  • onSwipePrev (Function) - Callback when calendar is swiped to previous week/days
  • locale (String) - locale for the header, there's a addLocale function to add cusomized locale. Default is en.

Event Object

{
  id: 1,
  description: 'Event',
  startDate: new Date(),
  endDate: new Date(),
  color: 'blue',
}

Locales customization

There's a addLocale function to add customized locale for component. This component depends on momentjs, we 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('_'),
});

TODO

  • allow to swipe between weeks or days.
  • header should be swipeable with columns.
  • allow to drag drop events to specific time and date.
  • update example for more cases (1 day, 7 days).
  • update document.

About

Week View Component for react-native

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 71.3%
  • Objective-C 15.6%
  • Python 7.8%
  • Java 5.3%