Socket
Socket
Sign inDemoInstall

react-native-month-selector

Package Overview
Dependencies
7
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-month-selector

Swipable month selector in react native


Version published
Weekly downloads
172
decreased by-0.58%
Maintainers
1
Install size
4.20 MB
Created
Weekly downloads
 

Readme

Source

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

ParamsTypeDefaultDescription
selectedDatemoment.Moment (a valid moment.js instance)moment()currently highlighted / selected month
currentDatemoment.Momentmoment()today's date
maxDatemoment.Momentmoment()the maximum date than can be shown
minimumDatemoment.Momentmoment("01-01-2000", "DD-MM-YYYY")the mimimum date than can be shown
selectedBackgroundColorstring"#000"the color of the highlight for the seleced month
selectedMonthTextStyleTextStyle{ color: "#fff" }text style for the selected month
seperatorHeightnumber1height of the separators
seperatorColorstring"#b6c3cb"color of the separators
nextIconJSX.Elementnullcustom react component for the next button
prevIconJSX.Elementnullcustom react component for the prev button
nextTextstring"Next"custom text for the next button
prevTextstring"Prev"custom text for the prev button
containerStyleViewStylenullcustom style for the container
yearTextStyleTextStylenullcustom style for the year text
monthTextStyleTextStylenullcustom style of the text for the months
currentMonthTextStyleTextStylenullcustom style for the current month text
initialViewmoment.Momentmoment()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)
monthDisabledStyleTextStyle{ color: "#00000050" }text style for disabled months
localeLanguagestring"en"specify the localization language for moment.js
localeSettingsmoment.LocaleSpecification{}to update the moment.js localization settings
swipablebooleanfalseenables swiping between pages
velocityThresholdnumber0.3Velocity that has to be breached in order for swipe to be triggered (vx and vy properties of gestureState)
directionalOffsetThresholdnumber80Absolute offset that shouldn't be breached for swipe to be triggered (dy for horizontal swipe, dx for vertical swipe)
gestureIsClickThresholdnumber5Absolute distance that should be breached for the gesture to not be considered a click (dx or dy properties of gestureState)

Sample Usage

  <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}
          monthTapped={(date) => this.setState({ month: date })}
      />
    </View>

Month Calendar

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

Contributors

  • vinodkumar8
  • is343
  • isaaclem

Keywords

FAQs

Last updated on 17 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc