1.0.1 • Published 3 years ago

rn-simple-schedule v1.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

Schedule React-Native component.


This is a simple week schedule component in React-Native. You can add appointments with their title, subtitle, day of week, start time, end time and color.

Screenshot

Install

It's very easy to install it. Run this commmand in your terminal :

npm install rn-simple-schedule

Exemple

import React from 'react';
import Schedule from 'rn-simple-schedule';

const data = [
    {
      Title: 'Meeting with John',
      Subtitle: 'About the new project',
      DayIndex: 1, //Monday
      StartTime: '08:30',
      EndTime: '09:30',
      Color: "#56b7fc"
    },
    {
      Title: 'Stay at home',
      Subtitle: 'Stay cool',
      DayIndex: 6, //Saturday
      StartTime: '08:30',
      EndTime: '18:30',
      Color: "#00ff67"
    }
  ];

export default function App() {
  return (
    <Schedule 
      lang='en'
      data={data} 
      rowSize={100}
      minHour={8}
      minMinute={30}
      numberOfRows={10}
      canRemove={false}
      darkMode={false}
      onAppointmentRemoved={(app)=>console.log(app)}
      onSelectedDayChanged={(dayIndex)=>console.log(dayIndex)}
    />
  );
}

Features

  • Customizable appointments colors
  • Adjuste size of an hour
  • Set the first hour to show
  • Choose the number of hours (rows) to show
  • Choose the language (english or french)
  • Popup to remove appointment (disablable)
  • Dark mode style (is auto managed by React-Native 0.63)

Props

None of the props are required !

PropDescriptionDefault valueType
dataArray of appointments objectsEmpty ArrayArray
rowSizeHeight of an hour cell100number
minHourFirst hour to show8number
minMinuteMinutes of the first hour to show30number
numberOfRowsNumber of hours (rows) to show13number
canRemoveIf true, a popup to remove the selected appointment , will appear, on press on it.trueboolean
darkModeEnable dark mode style (is auto managed by React-Native 0.63 or higher)Depending on device settingboolean
langLanguage used by the componenten (english)string
onAppointmentRemovedReturn a function triggered whenever user remove an appointement.nullfunction
onSelectedDayChangedReturn a function triggered whenever selected day changed.nullfunction

Data array of appointments objects

The data prop is an Array that must contains appointments objects with following format :

[
    {
      Title: 'Meeting with John',
      Subtitle: 'About the new project',
      DayIndex: 1,
      StartTime: '08:30',
      EndTime: '09:30',
      Color: "#56b7fc"
    }
]

Appointment object

KeyDescriptionTypeRequired
TitleTitle of the appointmentstringRequired
SubtitleText under the titlestringNo required
DayIndexDay index of appointment 1 : Monday 2 : Tuesday 3 : Wednesday ...numberRequired
StartTimeStart time of the appointment with format: hh:mmstringRequired
EndTimeEnd time of the appointment with format: hh:mmstringRequired
ColorBackground color of the appointmentColorValueNo required

Language

The lang prop allows to choose the language of component.

Values of this prop :

  • en : English language
  • fr : French language

Author

Admandev

Donation

If you like my work, you can make a donation.

Licence

Released under the MIT License.