Giter VIP home page Giter VIP logo

react-native-month-selector's Introduction

react-native-month-selector

This package lets you select months. It also allows you to use swipe gestures to navigate between pages.

Install

npm install react-native-month-selector --save
yarn add react-native-month-selector

Props

Params Type Default Description
selectedDate moment.Moment (a valid moment.js instance) moment() currently highlighted / selected month
currentDate moment.Moment moment() today's date
maxDate moment.Moment moment() the maximum date than can be shown
minDate moment.Moment moment("01-01-2000", "DD-MM-YYYY") the mimimum date than can be shown
selectedBackgroundColor string "#000" the color of the highlight for the seleced month
selectedMonthTextStyle TextStyle { color: "#fff" } text style for the selected month
seperatorHeight number 1 height of the separators
seperatorColor string "#b6c3cb" color of the separators
nextIcon JSX.Element null custom react component for the next button
prevIcon JSX.Element null custom react component for the prev button
nextText string "Next" custom text for the next button
prevText string "Prev" custom text for the prev button
containerStyle ViewStyle null custom style for the container
yearTextStyle TextStyle null custom style for the year text
monthTextStyle TextStyle null custom style of the text for the months
currentMonthTextStyle TextStyle null custom style for the current month text
initialView moment.Moment moment() which month should be selected initially
onMonthTapped (month: moment.Moment) => any (month) => {} function called when month is pressed
onYearChanged (year: moment.Moment) => any (year) => {} function called when the year is changed (when we navigate pages)
monthDisabledStyle TextStyle { color: "#00000050" } text style for disabled months
localeLanguage string "en" specify the localization language for moment.js
localeSettings moment.LocaleSpecification {} to update the moment.js localization settings
swipable boolean false enables swiping between pages
velocityThreshold number 0.3 Velocity that has to be breached in order for swipe to be triggered (vx and vy properties of gestureState)
directionalOffsetThreshold number 80 Absolute offset that shouldn't be breached for swipe to be triggered (dy for horizontal swipe, dx for vertical swipe)
gestureIsClickThreshold number 5 Absolute distance that should be breached for the gesture to not be considered a click (dx or dy properties of gestureState)

Sample Usage

import MonthSelectorCalendar from 'react-native-month-selector'; //add this import line

  <View style={styles.container}>
      <Text style={styles.welcome}>
        Selected Month is { this.state.month && this.state.month.format('MMM YYYY')}
      </Text>
      <MonthSelectorCalendar
          selectedDate={this.state.month}
          onMonthTapped={(date) => this.setState({ month: date })} 
      />
    </View>

Month Calendar

I'm open to keep this updated. Please open PRs!

Contributors

  • vinodkumar8
  • is343
  • isaaclem

react-native-month-selector's People

Contributors

vinodkumar8 avatar is343 avatar isaaclem avatar edgesinghkataria avatar zpalmtree avatar

Stargazers

Yudi Edri Alviska 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.