1.0.4 • Published 5 years ago

react-native-jumpable-calendar v1.0.4

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

react-native-jumpable-calendar

React Native calendar component for both Android and iOS. Users can use dropdown list to jump to any month in the range

Install

npm install react-native-jumpable-calendar --save

Example

ios

Usage

import React, { Component } from 'react'
import Calendar from 'react-native-jumpable-calendar'

class _NewCalendar extends Component {
  constructor(props) {
    super(props);
    this.state = {
      currentMonth: new Date().getMonth(),
      currentYear: new Date().getFullYear(),
      markedDates: {
        "2019-05-16": { selected: true, marked: true, selectedColor: "orange" },
        "2019-05-06": { selected: true, marked: true, selectedColor: "blue" },
        "2019-05-01": { selected: true, marked: true, selectedColor: "green" },
        "2019-05-17": { marked: true },
        "2019-06-18": { marked: true, dotColor: "red", activeOpacity: 0 },
        "2019-08-19": { disabled: true, disableTouchEvent: true },
      },
    };
  }
  render() {
    return (
        <View style={styles.calendarWrapper}>
          <Calendar
            pagingEnabled={true}
            scrollEnabled={true}
            pastScrollRange={50}
            futureScrollRange={50}
            showTodayButton={true}
            showMonthChooser={true}
            calendarWidth={300}
            onDayPress={day => {
              console.warn("day", day);
            }}
            markedDates={this.state.markedDates}
          />
        </View>
    );
  }
}

Properties

PropDefaultTypeDescription
currentDatetodaystringSpecify current date eg:'2018-08-08'
pastScrollRange50numberMax amount of months allowed to scroll to the past
futureScrollRange50numberMax amount of months allowed to scroll to the future.
scrollEnabledtruebooleanEnable or disable scrolling of calendar list
showScrollIndicatorfalsebooleanEnable or disable vertical scroll indicator.
scrollsToToptruebooleanWhen true, the calendar list scrolls to top when the status bar is tapped.
pagingEnabledtruebooleanEnable or disable paging on scroll
calendarWidthdevice widthnumberSpecify the width of this calendar component
showMonthChooserfalsebooleanController whether or not display monthChooser.
showTodayButtontruebooleanController whether or not display today button.
showCalendarTextHeaderfalsebooleanController whether or not display static calendar text header.
dayTextArr"Sun"..."Sat"arrayRestricts the range of possible date values.
markedDates{}objectCollection of dates that have to be marked.
dropdownStyle-objectThe hook of customize dropdown style.
dropdownListTextStyle-objectThe hook of customize dropdown style.
dropdownSelectionStyle-objectThe hook of customize dropdown style.
disabledDropdownListStyle-objectThe hook of customize dropdown style.
dropdownMenuStyle-objectThe hook of customize datepicker dropdown.
disabledDropdownMenuTextStyle-objectThe hook of customize dropdown style.
dropdownMenuTextStyle-objectThe hook of customize dropdown style.
dropdownTextHighlightStyle-objectThe hook of customize dropdown style.