npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-range-calendar

v0.0.1

Published

A calendar for react-native

Downloads

22

Readme

RN-calendar

A react-native calendar

Features

  1. Date Range select;
  2. custom render;
  3. holiday date and note data support;

screenshoot

ios screenshoot android screenshoot

Usage

npm install react-native-range-calendar --save

Demo

see demo

class CalendarDemo extends Component {

    state = {
        selectedDate: ['2017-03-30', '2017-04-09']
    }

    render() {
        return (
            <View style={{flex: 1, backgroundColor: '#fff', paddingTop: 20}}>
                <Calendar
                    showDateRange={['2017-03-03', '2017-11-11']}
                    enableDateRange={['2017-03-08', '2017-10-22']}
                    selectedDate={this.state.selectedDate}
                    onChange={(value) => { alert(JSON.stringify(value))}}
                    renderDate={(param = {}) => {
                        const { selected, innerSelected, date, text, disable } = param;
                    }}
                    holiday={{
                        '2017-03-08': {text: 'IWD', textStyle: {color: '#cf087b'}},
                        '2017-03-15': {text: '315', textStyle: {color: '#fff', backgroundColor:'#ff0000' }},
                        '2017-04-01': {text: `All Fools' Day`, textStyle: {fontSize: 10, textAlign: 'center', color: '#ef473a'}},
                        '2017-05-01': {text: '劳动节', textStyle: {color: '#ef473a'}},
                        '2017-06-01': {text: '儿童节', textStyle: {color: '#ef473a'}}
                    }}
                    note={{
                        '2017-03-08': {text: '50%off!', textStyle: {color: '#ff0000'}},
                        '2017-04-19': {text: '419大促', textStyle: {color: '#11c1f3'}},
                        '2017-04-11': {text: '打骨折!', textStyle: {color: '#ff0000'}}
                    }}
                />
            </View>
        );
    }
}

Props

    /**
     * the default selected value
     * like this: ['2017-03-30', '2017-04-09']
     * @type {[Array]}
     */
    selectedDate: PropTypes.array,

    /**
     * calendar range. Actually ,the calendar will display full month.
     * example: if showDateRange is ['2017-03-08', '2017-11-11'], the calendar render the month from 03 to 11, the date include 2017-03-01 and 2017-11-31
     * @type {[Array]}
     */
    showDateRange: PropTypes.array,

    /**
     * the enabled range , this value must belong to the showDateRange Array, it's the sub collection.
     * @type {[Array]}
     */
    enableDateRange: PropTypes.array,

    /**
     * enabled range select, default value is true;
     * if the value is false, you can select one date only.
     * @type {Boolean}
     */
    isRange: PropTypes.bool,

    /**
     * enabled the LayoutAnimation. default is true
     * @type {[Boolean]}
     */
    animate: PropTypes.bool,

    /**
     * holiday data extentions
     * example: {'2017-12-25', {text: 'Christmas', textStyle: {color: 'red'}}}
     *
     * @type {[object]}
     */
    holiday: PropTypes.object,

    /**
     * the note text , it is under the date text.
     * example: {'2017-12-25', {text: '🎄', textStyle: {}}}
     * @type {[object]}
     */
    note: PropTypes.object,

    /**
     * the calendar header renderer, normaly, it is monday to sunday.
     * @type {[Function]}
     */
    renderHeader: PropTypes.func,

    /**
     * the header of each month renderer.
     * @param object
     * @type {[Function]}
     */
    renderMonthHeader: PropTypes.func,

    /**
     * you can get a param, and costom render the date cell
     * @param object. the param is shape of { selected, innerSelected, date, text, disable }
     * @type {[Function]}
     */
    renderDate: PropTypes.func,

    /**
     * event, when you change the selected date
     * @param date|String, info|object, event|Object
     * @type {[Function]}
     */
    onChange: PropTypes.func,

    /**
     * when you press the date cell, it will be fired enven if the date is disabled.
     * @param dayInfo|object, event|Object
     * @type {[Function]}
     */
    onPress: PropTypes.func