GithubHelp home page GithubHelp logo

rnschedule's Introduction

React Native Schedule View

This React Native component provides a scheduling view with space for unused time. Similar to Google Calendar's Day View.

Installing

Installing is pretty simple:

npm install rnschedule

OR

yarn add rnschedule

Example

import React from 'react';
import RNSchedule from 'rnschedule';

const data = [
    {
      title: 'Lunch Appointment',
      subtitle: 'With Harry',
      start: new Date(2018, 11, 2, 13, 20),
      end: new Date(2018, 11, 2, 14, 20),
      color: '#390099',
    }
  ]

const App = () =>
  <RNSchedule
    dataArray={data}
    onEventPress={(appt) => console.log(appt)}
  />

export default App

Demo

Gif Demo

Features

  • Moving "now" bar.
  • Initial loads view on today centered on "now."
  • Customizable appointment colors.
  • Scaled size of an hour to improve readability on various device sizes.
  • Adjustable hour sizing to make it size to whatever you want.

Properties API

None of the following properties are required. A simple Will still render an empty schedule.

Prop Description Default Type
hourSize Change the width of lines between hours. depends on screen size Number
headerColor Background color of the calendar header strip. Acceptable formats: Hex, RGB(A), HSL(A), HSV(A), and named strings. See Tinycolor for all formats. #F5F5F6 String or Object
dataArray Array of date appointment objects. See below example. Empty Array Array
leftIcon Include your own icon to the left of the day number. Null React Component
accentColor Color of day circle in top left. Accepts Tinycolor formats. #1976d2 String or Object
status_bar Do you want extra margin for the status bar for iOS? true Boolean
onEventPress Return function for pressing a schedule event. Returns original data. null Function

Data Array Appt Objects

The dataArray prop must be an Array of appointment objects with the following format.

[
  {
    title: 'Lunch Appointment',
    subtitle: 'With Harry',
    start: new Date(2018, 11, 2, 13, 20),
    end: new Date(2018, 11, 2, 14, 20),
    color: '#390099'
  }
]
Appt Object API
Key Description Type Req
title Top title for the appointment. String Required
subtitle Slightly less bolded subtitle. String Not Required
start When the appointment starts. Date Required
end When the appointment ends. Date Required
color Background color for the appointment. Tinycolor Accepted String/Object Not Required

For onEventPress function - additional properties may be passed so long as they don't interfere with the above api.

Built With

Thanks to these wonderful people for making some great stuff.

Contributing

I'm looking to add new contributors/maintainers to help out. So if you like this repo and want to help make it better let me know.

To-Do List

The component is very much under-construction. Want to help build something? Here is my to-do list:

  • Provide more control over Day Selector Styling.
  • Work on speed optimization.
  • Swipe to change days.
  • Full Day appointments.
  • Multi-Day appointments.
  • Option for dots on days with appts.
  • Events longer than 24 hours.
  • Spec UI to Material Design.
  • Build out testing.
  • Contribution guidelines.
  • Break out schedule view as stand-alone without cal select header.
  • Fix Shadowing on Header - feels weird.

Special Thanks

  • Special thanks to Wix's RN Calendar for getting things started and providing inspiration.

rnschedule's People

Contributors

wmlutz avatar danielmschmidt avatar eyalabadi98 avatar

Stargazers

Saurav Maheshwari avatar LeonAndrade avatar Jehoshaphat Allenlyon avatar Emirhan avatar Adam Binnersley avatar Nathan Power avatar  avatar  avatar Davi Santos R avatar Hosni Colina avatar Sukrit Khera avatar Sher_lock avatar Dan Badham avatar Gabriel Guimarães Almeida de Castro avatar  avatar Muhamad Zulfiqor avatar Nikolay Lapa avatar Peter Gartner avatar Vladimir avatar Ian avatar Aslan avatar Filippos Sakellaropoulos avatar Balaji Damodaran avatar Pavel Ermakov avatar João Dematé Jr avatar Johan Porras avatar Park, Hyun Jung avatar Ngoc T P Nguyen avatar  avatar Muhamed Ahmed avatar Shannon Clarke avatar  avatar Anthony Nadaletti avatar Matthew Phiong avatar Niezwan Abdul Wahid avatar Hazim Ali avatar  avatar Patrick Cauley avatar Keith Hörling avatar Kimble Young avatar  avatar Jean-Marie Porchet avatar  avatar April Mintac Pineda avatar April Mintac Pineda avatar Yinwei (Charlie) Zhang avatar Matt avatar

Watchers

 avatar  avatar

rnschedule's Issues

Timer Error

Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See facebook/react-native#12981 for more info.
(Saw setInterval with duration 612143.928035982ms)

  • node_modules\expo\build\environment\logging.js:25:23 in warn
  • node_modules\react-native\Libraries\YellowBox\YellowBox.js:67:8 in warn
  • node_modules\react-native\Libraries\Core\Timers\JSTimers.js:274:8 in setInterval
  • node_modules\rnschedule\src\components\NowBar.js:20:33 in componentDidMount
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:12144:10 in commitLifeCycles
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:13496:8 in commitAllLifeCycles
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:92:15 in invokeGuardedCallbackImpl
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:306:36 in invokeGuardedCallback
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:13702:8 in commitRoot
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15269:13 in completeRoot
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15197:21 in performWorkOnRoot
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15090:24 in performWork
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15047:14 in performSyncWork
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:14925:19 in requestWork
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:14711:16 in scheduleWork
  • node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:7700:17 in enqueueSetState
  • node_modules\react\cjs\react.development.js:364:31 in setState
  • node_modules@react-navigation\native\src\createAppContainer.js:351:22 in dispatch
  • node_modules@react-navigation\core\lib\module\getChildNavigation.js:1:1529 in
  • screens\Auth\SignIn\SignInScreen.js:85:37 in _callee$
  • node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
  • node_modules\regenerator-runtime\runtime.js:271:30 in invoke
  • node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
  • node_modules\regenerator-runtime\runtime.js:135:28 in invoke
  • node_modules\regenerator-runtime\runtime.js:145:19 in
  • node_modules\promise\setimmediate\core.js:37:14 in tryCallOne
  • node_modules\promise\setimmediate\core.js:123:25 in
  • node_modules\react-native\Libraries\Core\Timers\JSTimers.js:152:14 in _callTimer
  • node_modules\react-native\Libraries\Core\Timers\JSTimers.js:200:17 in _callImmediatesPass
  • node_modules\react-native\Libraries\Core\Timers\JSTimers.js:464:30 in callImmediates
  • [native code]:null in callImmediates
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:320:6 in __callImmediates
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:297:10 in __guard
  • node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:17 in flushedQueue
  • [native code]:null in flushedQueue
  • [native code]:null in invokeCallbackAndReturnFlushedQueue

Month and Weekly display rnschedule

It will be great to have a display mode that includes monthly and weekly events. (Identical to Google Agenda). Is it possible to have these functionalities in the next release ?

week- view

Big work. Possible to view by week? How fullcalendar?

backward compatible ?

Hye, this is really great project!
Thanks.

just want to ask whether this project can be modified to ensure it's backward compatible ? I'm using react-native 0.51 & react 16.0.0 but this project require 16.5.0 as it's using context api and few others which not available to my current version.

Opening Calendar on physical device

Hello.

When I run the app with my physical device, the schedule doesnt respond.

More specifically, when I press the date button (to open the calendar view) it doesnt respond.

This doesnt happen on the simulator. I am suspecting an issue with how the Date is handeled in V8 vs chrome JS

Time conflict

Hey!

Would it be possible to make conflicting slots appear next to each other?

Like if I have 2 appointments that overlap to have them next to each other?

Thanks!

Translation

When i change moment.locale() so i can translate days and months, the header get the translation, but the drop down calendar is not ?
is it a bug or something not yet implemented?

hourSize changing time

Hello!

Thanks for the great package!

I encountered an issue that if I set hourSize to a value, the item change's location (In respect to time), meaning its not adjusting to the changed hour size difference

The reason I need to increase the time is that the entire text doesnt fit into the box:

image

So when I change the hoursize:
screen shot 2018-10-16 at 12 49 21 pm

dependency issues with newer react-native version

Is there a way to upgrade the version and build at my end as an dependency in my project? Please suggest.
Possible to

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/react-native
npm ERR!   react-native@"https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.57.1" from [email protected]
npm ERR! node_modules/rnschedule
npm ERR!   rnschedule@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/kumar/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/kumar/.npm/_logs/2021-04-02T18_15_21_964Z-debug.log

Feature request - marked dates

Hello i love thing package, is sad that it has not been maintained for a long time, i wanted to suggest a feature that will display marked dates, i have already coded the feature i will be willing to do a PR for that.
ps :i also have some minor problem with the grid, i will try to look into it.

photo5963210182806844008

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.