Giter Club home page Giter Club logo

calendarpicker's Introduction

react-native-calendar-picker

npm version npm Build Status

This is a Calendar Picker Component for React Native

Breaking changes in 8.x - replaced moment with date-fns

We've migrated away from moment.js, in favor of date-fns, a modular and lightweight alternative. Users wanting to continue to use Moment should stick with 7.x

Prerequisites

CalendarPicker requires date-fns >=3.0. Date props may be anything parseable by the Javascript Date object, such as a Javascript Date, or ISO8601 datetime string.

npm install --save date-fns

Scrollable CalendarPicker — New in 7.x

The scrollable prop was introduced in 7.0.0 and features a bi-directional infinite scroller. It recycles months using RecyclerListView, shifting them as the ends are reached. If the Chrome debugger is used during development, month shifting may be erratic due to a RN setTimeout bug. To prevent month shifts at the ends of the scroller, set restrictMonthNavigation, minDate, and maxDate range to 5 years or less.

alt tag

To use the calendar you just need to:

npm install --save react-native-calendar-picker

Example

import React, { Component } from "react";
import { StyleSheet, Text, View } from "react-native";
import CalendarPicker from "react-native-calendar-picker";

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selectedStartDate: null,
    };
    this.onDateChange = this.onDateChange.bind(this);
  }

  onDateChange(date) {
    this.setState({
      selectedStartDate: date,
    });
  }
  render() {
    const { selectedStartDate } = this.state;
    const startDate = selectedStartDate ? selectedStartDate.toString() : "";
    return (
      <View style={styles.container}>
        <CalendarPicker onDateChange={this.onDateChange} />

        <View>
          <Text>SELECTED DATE:{startDate}</Text>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#FFFFFF",
    marginTop: 100,
  },
});

CalendarPicker Props

Prop Type Description
weekdays Array Optional. List of week days. Eg. ['Mon', 'Tue', ...] Must be 7 days
months Array Optional. List of months names. Eg. ['Jan', 'Feb', ...] Must be 12 months
firstDay Number Optional. Default first day of week will be Sunday. You can set start of week with number from 0 to 6. Default is 0 or Sunday
startFromMonday Boolean Optional. Default first day of week will be Sunday. You can set start of week from Monday by setting this to true. Default is false
showDayStragglers Boolean Optional. Populate previous & next month days in empty slots. Default is false
allowRangeSelection Boolean Optional. Allow to select date ranges. Default is false
allowBackwardRangeSelect Boolean Optional. Allow selecting range in reverse. Default is false
previousTitle String Optional. Title of button for previous month. Default is Previous
nextTitle String Optional. Title of button for next month. Default is Next
previousTitleStyle TextStyle Optional. Text styling for Previous text.
nextTitleStyle TextStyle Optional. Text styling for Next text.
previousComponent Object Optional. Component to use in Previous button. Overrides previousTitle & previousTitleStyle.
nextComponent Object Optional. Component to use in Next button. Overrides nextTitle & nextTitleStyle.
selectedDayColor String Optional. Color for selected day
selectedDayStyle ViewStyle Optional. Style for selected day. May override selectedDayColor.
selectedDayTextColor String Optional. Text color for selected day
selectedDayTextStyle Object Optional. Text style for selected day (including all days in range)
selectedRangeStartTextStyle Object Optional. Text style for start day of range
selectedRangeEndTextStyle Object Optional. Text style for end day of range
selectedRangeStartStyle ViewStyle Optional. Container style for start day of range.
selectedRangeEndStyle ViewStyle Optional. Container style for end day of range.
selectedRangeStyle ViewStyle Optional. Container style for all days in range selection.
selectedDisabledDatesTextStyle Object Optional. Text style for ineligible dates during range selection.
disabledDates Array or Function Optional. Specifies dates that cannot be selected. Array of Dates, or a function that returns true for a given date (apologies for the inverted logic).
disabledDatesTextStyle TextStyle Optional. Text styling for disabled dates.
selectedStartDate Date Optional. Specifies a selected Start Date.
selectedEndDate Date Optional. Specifies a selected End Date.
minRangeDuration Number or Array Optional. Specifies a minimum range duration when using allowRangeSelection. Can either pass a number to be used for all dates or an Array of objects if the minimum range duration depends on the date {date: parsable date, minDuration: Number}
maxRangeDuration Number or Array Optional. Specifies a maximum range duration when using allowRangeSelection. Can either pass a number to be used for all dates or an Array of objects if the maximum range duration depends on the date {date: parsable date, maxDuration: Number}
todayBackgroundColor String Optional. Background color for today. Default is #cccccc
todayTextStyle TextStyle Optional. Text styling for today.
textStyle TextStyle Optional. Style overall text. Change fontFamily, color, etc.
customDatesStyles Array or Func Optional. Style individual date(s). Supports an array of objects {date: parseable date, containerStyle: ViewStyle, style: ViewStyle, textStyle: TextStyle, allowDisabled: Boolean}, or a callback which receives a date param and returns {containerStyle: ViewStyle, style: ViewStyle, textStyle: TextStyle, allowDisabled: Boolean} for that date.
customDayHeaderStyles Func Optional. Style day of week header (Monday - Sunday). Callback that receives ISO {dayOfWeek, month, year} and should return {style: ViewStyle, textStyle: TextStyle}
scaleFactor Number Optional. Default (375) scales to window width
minDate Date Optional. Specifies minimum date to be selected
maxDate Date Optional. Specifies maximum date to be selected
initialDate Date Optional. Date that calendar opens to. Defaults to today.
width Number Optional. Width of CalendarPicker's container. Defaults to Dimensions width.
height Number Optional. Height of CalendarPicker's container. Defaults to Dimensions height.
scrollable Boolean Optional. Months are scrollable if true. Default is false
horizontal Boolean Optional. Scroll axis when scrollable set. Default is true
scrollDecelarationRate Number / "normal" / "fast" Optional. Determines how quickly the scroll view decelerates after the user lifts their finger. Default is normal
enableDateChange Boolean Optional. Whether to enable pressing on day. Default is true
restrictMonthNavigation Boolean Optional. Whether to disable Previous month button if it is before minDate or Next month button if it is after MaxDate. Default is false
onDateChange Function Optional. Callback when a date is selected. Returns date as first param; START_DATE or END_DATE as second param.
onMonthChange Function Optional. Callback when Previous / Next month is pressed. Returns date as first parameter.
dayShape String Optional. Shape of the Day component. Default is circle. Available options are circle and square.
headingLevel Number Optional. Sets the aria-level for the calendar title heading when on Web. Default is 1.
selectMonthTitle String Optional. Title of month selector view. Default is "Select Month in " + {year}.
selectYearTitle String Optional. Title of year selector view. Default is "Select Year".
dayLabelsWrapper ViewStyle Optional. Style for weekdays wrapper. E.g If you want to remove top and bottom divider line.
enableSwipe Deprecated Use scrollable.
swipeConfig Deprecated Use scrollable.
onSwipe Deprecated Use onMonthChange.
dayOfWeekStyles Deprecated Use customDatesStyles & customDayHeaderStyles callbacks to style individual dates, days of week, and/or header.
customDatesStylesPriority Deprecated Use customDatesStyles & customDayHeaderStyles callbacks to style individual dates, days of week, and/or header.
monthYearHeaderWrapperStyle ViewStyle Optional. Style for header MonthYear title wrapper. E.g If you want to change the order of year and month.
headerWrapperStyle ViewStyle Optional. Style for entire header controls wrapper. This contains the previous / next controls plus month & year.
monthTitleStyle TextStyle Optional. Text styling for header's month text.
yearTitleStyle TextStyle Optional. Text styling for header's year text.
initialView String Optional. The view that the calendar opens to. Default is days. Available options are years, months, and days.
fontScaling Boolean Optional. To enable fontScaling. Default is true

Styles

Some styles will overwrite some won't. For instance:

  • If you provide textStyle with fontFamily and color, out of ranges dates will not apply your color, just fontFamily.

Order of precedence:

  • defaultColor => textStyle => selectedDayColor
  • defaultTodayBackgroundColor => todayBackgroundColor
  • defaultBackgroundColor => selectedDayColor
  • defaultTextStyles => textStyle => selectedDayTextColor

More Examples

Start from Monday, allowRangeSelection, Min and Max Dates and Styles Changes Example

alt tag

import React, { Component } from "react";
import { StyleSheet, Text, View } from "react-native";
import CalendarPicker from "react-native-calendar-picker";

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selectedStartDate: null,
      selectedEndDate: null,
    };
    this.onDateChange = this.onDateChange.bind(this);
  }

  onDateChange(date, type) {
    if (type === "END_DATE") {
      this.setState({
        selectedEndDate: date,
      });
    } else {
      this.setState({
        selectedStartDate: date,
        selectedEndDate: null,
      });
    }
  }

  render() {
    const { selectedStartDate, selectedEndDate } = this.state;
    const minDate = new Date(); // Today
    const maxDate = new Date(2017, 6, 3);
    const startDate = selectedStartDate ? selectedStartDate.toString() : "";
    const endDate = selectedEndDate ? selectedEndDate.toString() : "";

    return (
      <View style={styles.container}>
        <CalendarPicker
          startFromMonday={true}
          allowRangeSelection={true}
          minDate={minDate}
          maxDate={maxDate}
          todayBackgroundColor="#f2e6ff"
          selectedDayColor="#7300e6"
          selectedDayTextColor="#FFFFFF"
          onDateChange={this.onDateChange}
        />

        <View>
          <Text>SELECTED START DATE:{startDate}</Text>
          <Text>SELECTED END DATE:{endDate}</Text>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#FFFFFF",
    marginTop: 100,
  },
});

Complex Example, Changing Fonts and Colors, Language and etc...

alt tag

import React, { Component } from "react";
import { StyleSheet, Text, View } from "react-native";
import CalendarPicker from "react-native-calendar-picker";

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selectedStartDate: null,
      selectedEndDate: null,
    };
    this.onDateChange = this.onDateChange.bind(this);
  }

  onDateChange(date, type) {
    if (type === "END_DATE") {
      this.setState({
        selectedEndDate: date,
      });
    } else {
      this.setState({
        selectedStartDate: date,
        selectedEndDate: null,
      });
    }
  }

  render() {
    const { selectedStartDate, selectedEndDate } = this.state;
    const minDate = new Date(); // Today
    const maxDate = new Date(2017, 6, 3);
    const startDate = selectedStartDate ? selectedStartDate.toString() : "";
    const endDate = selectedEndDate ? selectedEndDate.toString() : "";

    return (
      <View style={styles.container}>
        <CalendarPicker
          startFromMonday={true}
          allowRangeSelection={true}
          minDate={minDate}
          maxDate={maxDate}
          weekdays={["Seg", "Ter", "Qua", "Qui", "Sex", "Sab", "Dom"]}
          months={[
            "Janeiro",
            "Fevereiro",
            "Março",
            "Abril",
            "Maio",
            "Junho",
            "Julho",
            "Agosto",
            "Setembro",
            "Outubro",
            "Novembro",
            "Dezembro",
          ]}
          previousTitle="Anterior"
          nextTitle="Próximo"
          todayBackgroundColor="#e6ffe6"
          selectedDayColor="#66ff33"
          selectedDayTextColor="#000000"
          scaleFactor={375}
          textStyle={{
            fontFamily: "Cochin",
            color: "#000000",
          }}
          onDateChange={this.onDateChange}
        />

        <View>
          <Text>SELECTED START DATE:{startDate}</Text>
          <Text>SELECTED END DATE:{endDate}</Text>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#FFFFFF",
    marginTop: 100,
  },
});

Custom styling individual dates

alt tag

let today = new Date();
let day = today.clone().startOf('month');
let customDatesStyles = [];
while(day.add(1, 'day').isSame(today, 'month')) {
  customDatesStyles.push({
    date: day.clone(),
    // Random colors
    style: {backgroundColor: '#'+('#00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6)},
    textStyle: {color: 'black'}, // sets the font color
    containerStyle: [], // extra styling for day container
    allowDisabled: true, // allow custom style to apply to disabled dates
  });
}

render() {
  return (
    <CalendarPicker
      todayTextStyle={{fontWeight: 'bold'}}
      todayBackgroundColor={'transparent'}
      customDatesStyles={customDatesStyles}
      minDate={today}
    />
  );
}

Styling each day of the week and the day name header.

const customDayHeaderStylesCallback = {dayOfWeek, month, year} => {
  switch(dayOfWeek) { // can also evaluate month, year
    case 4: // Thursday
      return {
        style: {
          borderRadius: 12,
          backgroundColor: 'cyan',
        },
        textStyle: {
          color: 'blue',
          fontSize: 22,
          fontWeight: 'bold',
        }
      };
  }
}

const customDatesStylesCallback = date => {
  switch(date.isoWeekday()) {
    case 1: // Monday
      return {
        style:{
          backgroundColor: '#909',
        },
        textStyle: {
          color: '#0f0',
          fontWeight: 'bold',
        }
      };
    case 7: // Sunday
      return {
        textStyle: {
          color: 'red',
        }
      };
  }
}

<CalendarPicker
      customDayHeaderStyles={customDayHeaderStylesCallback}
      customDatesStyles={customDatesStylesCallback}
    />

Methods

These internal methods may be accessed through a ref to the CalendarPicker.

Name Params Description
handleOnPressDay {year, month, day} (Integers) Programmatically select date. year, month and day are numbers. day is the day of the current month. date-fns example for today's day of month: getDate(new Date())
handleOnPressNext Programmatically advance to next month.
handleOnPressPrevious Programmatically advance to previous month.
resetSelections Clear date selections. Useful for resetting date range selection when user has picked a start date but not an end date.

TypeScript

Definitions are available at https://www.npmjs.com/package/@types/react-native-calendar-picker courtesy of automatensalat.

npm install --save @types/react-native-calendar-picker

Suggestions?

Open Issues. Submit PRs.

Special Thanks

I would like to call out some contributors who have been helping with this project

Sample Application

The sample app is an Expo project created with create-react-native-app.

cd example
npm run cp
npm install
npm start

Development

The source files are copied from the project root directory into example using npm run cp. If a source file is modified, it must be copied over again with npm run cp.

calendarpicker's People

Contributors

aaronabramov avatar aca-mobile avatar ademars94 avatar adpuckett87 avatar andersos avatar andrey-skl avatar aroldogoulart avatar automatensalat avatar dakaz avatar dmarcucci avatar giorgiofellipe avatar imokhles avatar ironelder avatar jbseppanen avatar joshuapinter avatar kesha-antonov avatar kvasbo avatar lanbau avatar listiani13 avatar margaferrez avatar measim avatar mgmolisani avatar peacechen avatar prabaperera avatar rajeshkumdev avatar ratson avatar rohantalip avatar skulegirl avatar superandrew213 avatar tranjog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calendarpicker's Issues

selectedDate changes when month changed

expected behavior - would be that if you change the month then the selectedDate remains the same (out of view).

actual behavior - selected date follows you Oct. 15 -> Nov 15

The expected is how all OS calendars I've seen seem to work. I looked at this code briefly and had no thoughts on where to begin. Any suggestions?

node 6 is unsupported now

72ecec0 actually removed node6 support

yarn upgrade v0.27.5
[1/4] Resolving packages...
warning react-native-calendar-picker > react-native > xcode > [email protected]: Use uuid module instead
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=7.6.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

Master branch

Just wanted to let you know, that if I install current master branch, my app will not start due to some errors. It might be nothing. Maybe just my configuration ( I am using react-native": "^0.44.0"). Latest commit that everything works fine for me is 1b460d7

error: bundling: Error: ENOENT: no such file or directory, open '/node_modules/react-native-calendar-picker/node_modules/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Module._readSourceCode (/Users/urska/Documents/Projects/git_repos/goopti-driver-app/node_modules/react-native/packager/src/node-haste/Module.js:200:29)
at Module._getCacheProps (/Users/urska/Documents/Projects/git_repos/goopti-driver-app/node_modules/react-native/packager/src/node-haste/Module.js:420:29)
at Module._readFromTransformCache (/Users/urska/Documents/Projects/git_repos/goopti-driver-app/node_modules/react-native/packager/src/node-haste/Module.js:376:29)
at Module.readCached (/Users/urska/Documents/Projects/git_repos/goopti-driver-app/node_modules/react-native/packager/src/node-haste/Module.js:363:25)
at Promise.resolve.then (/Users/urska/Documents/Projects/git_repos/goopti-driver-app/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:167:29)
at process._tickCallback (internal/process/next_tick.js:103:7)

Have to subtract 1 from month for minDate?

I'm sure I'm just missing something silly, but if I try to set minDate like this
minDate={new Date(2017,4,17)}

It sets the minimum date as May 17, 2017 instead of Apr 17, 2017. It's easy enough to just do M-1, but before I do that I wanted to see if I'm missing something.

Awesome work BTW, best calendar component out there, so thank you!

Disable specific or multiple dates

The idea is to add disabledDates prop with list of date in array format which will become unable to choose from the picker.

I've created a PR #66 for this.

Example code

const disabledDates = [new Date('10 May, 2017'), new Date('12 May, 2017'), new Date('15 May, 2017')];

<CalendarPicker
...
disabledDates={disabledDates}
...
/>

Screenshots
screen shot 2560-05-04 at 11 28 58 pm

[Support Request] How to mark a date with color

Hi @stephy ,
Can we mark a certain date with a certain color?
For example: I'm having a meeting on 31 Dec 2016, this date should have red color.

If this feature is not available now, please add this feature in next release, I think it's easy for you as you marked the selected date with color already.
Thanks.

How can i do pull request to your project?

I want do pull request with posibility of mark multiple dates. I try to clone your repository and do:

$ git checkout -b mark_multiple_dates_implemented
$ git checkout mark_multiple_dates_implemented
$ git push -u origin mark_multiple_dates_implemented

But:

remote: Permission to stephy/CalendarPicker.git denied to luisfuertes.
fatal: unable to access 'https://github.com/stephy/CalendarPicker.git/': The requested URL returned error: 403

Can you tell me how can i do please?

External images in source code

Is there any specific reason you are having the images separated from the repo?
The current solution isn't the best because it's creating an huge dependency to the website that hosts those images.

I would suggest that we change

source={{ uri: 'http://stephanimoroni.com/kalendar/images/[email protected]'}}/>

(source) to

source={{ uri: 'images/[email protected]'}}/>

and the same with the right arrow. (source)

Remove react and react-native from dependencies

As soon as CalendarPicker depends on react and react-native:

    "react": "^0.14.8",
    "react-native": "^0.25.1"

That means that it cant be used with react 15 because it installs own copy of react and uses it. It leads to bad error (similar to facebook/react-native#7384):

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: TouchHistoryMath
  Paths: /Users/skladchikov/Documents/work/youtrack-mobile/node_modules/react-native-calendar-picker/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js collides with /Users/skladchikov/Documents/work/youtrack-mobile/node_modules/react/lib/TouchHistoryMath.js

This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
  Duplicate module name: TouchHistoryMath
  Paths: /Users/skladchikov/Documents/work/youtrack-mobile/node_modules/react-native-calendar-picker/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js collides with /Users/skladchikov/Documents/work/youtrack-mobile/node_modules/react/lib/TouchHistoryMath.js

This error is caused by a @providesModule declaration with the same name accross two different files.
    at HasteMap._updateHasteMap (/Users/skladchikov/Documents/work/youtrack-mobile/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:160:15)
    at /Users/skladchikov/Documents/work/youtrack-mobile/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:125:25

This library shouldn't be in dependencies.

Selection of multiple dates

Hi,

is there the intention to implement a feature that allows to basically select a from and end date? E.g. by swiping from one date to the other?

Would gladly support this implementation.

Regards
Philipp

Being able to select first day in calendar

It would be nice to be able to customize the calendar in such a way that you can specify whether its "Sun, Mon, Tue, Wed, etc." or "Mon, Tue, Wed, ...". In other countries, its more common to have the calendar start with "Monday" at the very left.

Thanks
Philipp

Dimensions unreliable for screen rotation and app resume

In our own app I've observed that Dimensions returns incorrect values when the app resumes some of the time, and when the screen is rotated all the time. Instead of calculating width/height off of Dimensions, the View's onLayout callback should be used since it's more reliable.
I'll create a PR to address this.

Error after installing CalendarPicker

Installing the library via:
$ npm install react-native-calendar-picker --save
installs a duplication of React and React-Native in node-modules, which causes the app to crash.

Removing ./react-native-calendar-picker/node-modules/React and ./react-native-calendar-picker/node-modules/React-Native folders seemed to have solved the problem manually.

Prevent Future (and Past) Dates from being selected. `minDate` and `maxDate` options.

An optional prop to pass in to prevent future dates from being selected.

While working on this, it'd be good to add an option to prevent past dates from being selected as well.

Just looking at jQuery's DatePicker, their API uses minDate and maxDate. Probably good to stick with a similar interface, so ours would look like:

let tomorrow = new Date();
tomorrow.setDate( ( new Date() ).getDate() + 1 );

<CalendarPicker maxDate={tomorrow} />

And for minDate:

let yesterday = new Date();
yesterday.setDate( (new Date() ).getDate() - 1);

<CalendarPicker minDate={yesterday} />

@stephy If you have any thoughts on this that would be great. I'll do a PR if you provide some guidance.

naming collision: Duplicate module name: String.prototype.es6

v5 of CalendarPicker is causing the error:

Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: String.prototype.es6
Paths: ...myrepo/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js collides with ...myrepo/node_modules/react-native-calendar-picker/node_modules/react-native/packager/src/Resolver/polyfills/String.prototype.es6.js

This error is caused by a @providesModule declaration with the same name across two different files.

It looks like this was re-introduced after the refactor (see #24).

  "dependencies": {
    "expo": "^15.1.0",
    "react": "~15.4.0",
    "react-native": "0.42.3"
  }

To continue to support running examples from within the CalendarPicker repo, move react & react-native to devDependencies:

  "devDependencies": {
    "expo": "^15.1.0"
    "react": "~15.4.0",
    "react-native": "0.42.3",
    ...
  },
  ...
  "dependencies": {
  }

Created PR #56 if that looks acceptable.

Wrong weekdays when applying startFromMonday={true}

@stephy ,
Thank you very much for the awesome plugin.
But when applying startFromMonday={true}, the weekdays do not update accordingly. It stills the same as before so the date and weekdays does not match.

date picker error

Can you please fix this soon?
Thanks.

Publish to NPM

It would be nice if we could make this compatible (maybe it is) with NPM.
Copy/paste the code isn't a good practice because everyone that is using the picker will need to manually update the code when we make changes.

Option to disable today's styling

The default behavior of highlighting today can be confusing. It makes it appear as though the current day is selected. Setting prop todayBackgroundColor to transparent can remove the today highlight, but since the text color for today is also set to transparent, no date is visible.

It would be helpful to add a prop such as disableTodayStyling to bypass highlighting today's date.

Performance issues?

It may just be me, but it seems that this component is extremely slow. There is a significant and noticeable delay between clicking a date and having it register on screen. There's a minor lag using the iOS emulator, but it is extremely noticeable to the point of being a hindrance on a real device (6S+).

I was just wondering if this was an issue people were aware of or others were experiencing or if I was alone in this.

Picker doesn't report new date

After selecting a date in the UI, the onDateChange callback doesn't report the new selected date. It requires two taps to make it report correctly.

run error

@stephy
I installed react-native-calendar-picker using npm.
But it has any errors.
image 2
image 4

Duplicate module name: react-native-vector-icons

Paths: .../project/node_modules/react-native-calendar-picker/node_modules/react-native/local-cli/core/fixtures/files/package.json collides with .../project/node_modules/react-native/local-cli/core/fixtures/files/package.json

Showing only months and year

Is it possible to modify this calendar to shown only months and year, i want to modify it to show only months and years like below view

<     2017           >
   Jan   Feb    Mar
   Apr   May    Jun
   Jul   Aug    Sep 
   Oct   Nov    Dec

Calendar is off a month

The calendar, when loading up, if the next button is pressed, the month days don't update. See gif

UnableToResolveError

Hi, Thanks for your component but i've this error after installed it.

Bundling: UnableToResolveError: Unable to resolve module react/lib/LinkedStateMixin from /Users/user/Documents/Projets/ZProjects/app/mobile/project/node_modules/react-native-calendar-picker/node_modules/react-native/Libraries/react-native/react-native.js: Module does not exist in the module map or in these directories:
/Users/user/Documents/Projets/ZProjects/app/mobile/project/node_modules/react-native-calendar-picker/node_modules/react/lib
, /Users/user/Documents/Projets/ZProjects/app/mobile/project/node_modules/react/lib
, /Users/user/node_modules/react/lib

React-Native V : 0.45.1
React V : 15.6.1

Thanks :)

Calendar overflows on smaller phones

Out of the box, this is what the calendar looks like on the iPhone 5s simulators (and down):

ios_simulator_-iphone_4s-iphone_4s___ios_8_3__12f69

How do I get it to fill the width of the screen without it overflowing on smaller phones?

I think a lot of it has to do with the hard coded widths in Styles.js.

I had some success by replacing the hard-coded widths in the wrappers with justifyContent: 'space-between but ran into some problems, mostly due to my inexperience with flex.

Column of dates disappear as i swipe to following months

Hi, there seems to be a bug, where the dates of a specific day of the month (eg. Wed) disappears as I swipe to other months. And the column in which the days disappear also changes as I swipe to different months. Im using Samsung S5.

Open calendar to another date

CalendarPicker opens to the current date by default. Is there a way to get it to open to another date? The use case is a date field that is pre-filled to an arbitrary date in the future, and opening the calendar picker should center to that date. With CalendarPicker's current behavior of opening to the current date, the user has to potentially click through many months to get back to the pre-filled date.

Publish latest version to npm

@stephy
The fix that moved React from dependencies to devDependencies isn't on npm, and it's causing repeated failures on the newer releases of RN:
facebook/react-native#14302

It would be very helpful to publish the latest version to npm to prevent people from hitting this bug again and again.

Support Android

Hi,
do you have plans to CalendarPicker in android?

obrigado,
joão

@providesModule naming collision

I just upgraded to the latest RN and I'm getting a load of @providesModule naming collision errors coming from CalendarPicker - too many to paste them all but for example..

This warning is caused by a @providesModule declaration with the same name across two different files.
Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons
  Paths: /Users/simon/dev/MyApp/node_modules/react-native/local-cli/core/__fixtures__/files/package.json collides with /Users/simon/dev/MyApp/node_modules/react-native-calendar-picker/node_modules/react-native/local-cli/core/__fixtures__/files/package.json

I can't really figure out if this is a RN issue or something that can be addressed in this component. The latter seems more likely as it's the only package I've added since and comes up in all of the errors.

Thanks

RN v0.43.3
CalendarPicker v5.7.0

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.