Coder Social home page Coder Social logo

patradanai / react-native-toggle-calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from varunon9/react-native-toggle-calendar

0.0 1.0 0.0 4.34 MB

React Native Calendar Components ๐Ÿ“†

License: MIT License

JavaScript 87.88% Python 2.29% Java 2.35% Objective-C 5.73% Ruby 1.76%

react-native-toggle-calendar's Introduction

React Native Toggle Calendar

Horizontal as well as Grid calendar built on top of react-native-calendars

Demo

What's special

react-native-calendars has no support for custom header and horizontal scrollable calendar. This package provides these features along with some other properties like showing loader inside calendar.

Usage

  1. Install this library yarn add react-native-toggle-calendar
  2. Use in your component like-
  import { Calendar } from 'react-native-toggle-calendar';

  <Calendar
    current={this.state.selectedCalendarMonthString}
    minDate={currentDate.format('YYYY-MM-DD')}
    dayComponent={CalendarDayComponent}
    calendarHeaderComponent={CalendarHeaderComponent}
    headerData={this.state.calendarHeaderData}
    style={styles.calendar}
    onPressArrowLeft={this.onPressArrowLeft}
    onPressArrowRight={this.onPressArrowRight}
    onPressListView={this.onPressListView}
    onPressGridView={this.onPressGridView}
    markedDates={this.state.calendarMarkedDates}
    horizontal={this.state.horizontal}
    onDayPress={this.onDayPress}
    horizontalEndReachedThreshold={50}
    horizontalStartReachedThreshold={0}
    loading={this.state.calendarLoading}
    showPastDatesInHorizontal={1}
  />

Available props

All the props of https://github.com/wix/react-native-calendars are supported. Newly added ones are-

  // Provide custom calendar header rendering component
  calendarHeaderComponent: PropTypes.any,
  // data which is passed to calendar header, useful only when implementing custom calendar header
  headerData: PropTypes.object,
  // Handler which gets executed when press list icon. It will set calendar to horizontal
  onPressListView: PropTypes.func,
  // Handler which gets executed when press grid icon. It will set calendar to grid
  onPressGridView: PropTypes.func,
  // to show horizontal calendar with scroll
  horizontal: PropTypes.bool,
  // to automatically scroll horizontal calendar to keep selected date in view
  autoHorizontalScroll: PropTypes.bool,
  // how many past days to be shown, if this is set - autoHorizontalScroll will not work
  showPastDatesInHorizontal: PropTypes.number,
  // offset to decide when to trigger onPressArrowRight in horizontal calendar,
  // 0 means when rightmost day is reached, undefined means no auto onPressArrowRight triggering
  horizontalEndReachedThreshold: PropTypes.number,
  // offset to decide when to trigger onPressArrowLeft in horizontal calendar,
  // 0 means when leftmost day is reached, undefined means no auto onPressArrowLeft triggering
  horizontalStartReachedThreshold: PropTypes.number,
  // to show a loader
  loading: PropTypes.bool,
  // provide a custom loader component
  LoaderComponent: PropTypes.any

Sample Calendar Day and Header Components-

Check this gist: https://gist.github.com/varunon9/e204479219a55d86c4d8a985bae4e7f1

Code changes from original package

Check this PR: varunon9#1

Blog: https://medium.com/@varunon9/how-i-built-horizontal-as-well-as-grid-calendar-in-react-native-using-react-native-calendars-eb7a2edcc5db

react-native-toggle-calendar's People

Contributors

varunon9 avatar tigo0 avatar noamco avatar jaruyot avatar overengineered avatar albinekb avatar iday avatar kirgudkov avatar slorber avatar georgetroughton avatar nulleof avatar kkemple avatar guyca avatar maxaggedon avatar gaboelnuevo avatar astronin avatar sibelius avatar pinguinjkeke avatar jcmais avatar kcfgl avatar frusdelion avatar felipegodoy avatar mikaoelitiana avatar iamkun avatar nehrasajal avatar christophehurpeau avatar booker-laputa avatar gsaandy avatar martincamen avatar zidail avatar

Watchers

James Cloos avatar

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.