JSPM

react-native-calendar-readonly

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q17128F
  • License MIT

Calendar View for ReactNative.

Package Exports

  • react-native-calendar-readonly

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-calendar-readonly) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-calendar

Calendar component for ReactNative. It is stateless component.

example

install

npm install --save react-native-calendar-component

props

prop type default value
date Date new Date()
onDateSelect function null
onPrevButtonPress function null
onNextButtonPress function null
dayNames array ["Sun", "Mon" ... ]
monthNames array ["January", "February" ... ]
weekFirstDay number 0

usage

import React, { Component } from "react";
import Calendar   from "react-native-calendar-component";

export default class CalendarTest extends Component {
    constructor(props) {
        super(props);

        this.state = {
            date: new Date()
        };
    }

    handleNextButtonPress() {
        const date = new Date(this.state.date);
        date.setMonth(date.getMonth() + 1);
        this.setState({
            date
        });
    }

    handlePrevButtonPress() {
        const date = new Date(this.state.date);
        date.setMonth(date.getMonth() - 1);
        this.setState({
            date
        });
    }

    handleDateSelect(date) {
        alert(`clicked: ${this.state.date.toString()}`);
    }

    render() {
        return (
            <Calendar
                date={this.state.date}
                onPrevButtonPress={() => this.handlePrevButtonPress()}
                onNextButtonPress={() => this.handleNextButtonPress()}
                onDateSelect={(date) => this.handleDateSelect(date)} />
        );
    }
}