Giter Site home page Giter Site logo

yuvraj24 / react-native-picker-calendar-view Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 4.45 MB

A simple and fully customizable React Native library that can be used as a Date picker or a simple Calendar view 📅

Home Page: https://www.linkedin.com/in/yuvraj24/

Shell 0.28% JavaScript 3.09% Java 13.01% TypeScript 75.32% C 0.21% Objective-C 6.72% Swift 0.15% Ruby 1.22%
react reactnative react-components calendar calendarview calendar-view calendar-component datepicker date-picker

react-native-picker-calendar-view's Introduction

react-native-picker-calendar-view 📅 ✨

npm version Platform - Android and IOS

This is a highly customizable package 🔥 that can be used as a simple date picker as well as a calendar view 📅 for React Native developed with ❤️ in Typescript & React.
It is compatible with both Android and iOS platforms ✨

Highlights :

  • Supports custom day view in calendar.
  • Supports custom week view in calendar.
  • Supports complete custom header view in calendar.
  • Flexible component can be used within any view like bottom sheet etc.
  • Can be used as a simple date picker view for any use cases.
  • Supports restricting user to select between minimum date & maximum date only for validation.
  • Allows to change arrow images for left and right navigation.


Spread Your ❤️:

GitHub followers Twitter Follow

If you like the work then don't forget to hit that ⭐ button to show some appreciation & love
for this project as your token of love does wonders.

Installation

If using yarn:

yarn add react-native-picker-calendar-view

If using npm:

npm i react-native-picker-calendar-view

Screenshots : IOS

Custom day view Custom week view Custom header view

Screenshots : ANDROID

Custom day view Custom week view Custom header view

Usage

For example code, Click here

Basic Props

{

	/** Unique testid for the component */
	testId?: string;

	/** Parent style for the entire component. */
	style?: StyleProp<ImageStyle>;

	/** Display grid like view around each day, DEFAULT = true */
	isShowGrid?: boolean;

	/** Hide previous month & next month's extra days, DEFAULT = false */
	hideExtraDays?: boolean;

	/** Hide month & year navigation arrows, DEFAULT = false */
	hideArrows?: boolean;

	/** Callback which get invloked when a date is clicked, The function receives day, month & year as parameter  */
	onDayPress?: (props: { day: number; month: number; year: number }) => void;

	/** Replace default month and year title with custom one. The function receive a month ,year & other header props as parameter */
	renderHeader?: (props: {
		month: number;
		monthName: string;
		year: number;
		toggleMList: () => void;
		toggleYList: () => void;
		prevMonth: () => void;
		nextMonth: () => void;
	}) => JSX.Element;

	/** Render custom day component. the function receive all day props */
	renderDay?: (props: {
		testId?: string;
		index: number;
		day: DayProps;
		month: number;
		year: number;
		onDayPress?: (props: {
			day: number;
			month: number;
			year: number;
		}) => void
	}) => JSX.Element;

	/** Render custom week component. the function receive a all week props */
	renderWeekName?: (props: {
		testId?: string;
		value: {
			d: string; // eg. { d: "1", dd: "01", ddh: "Su", ddd: "Sun", dddd: "Sunday" },
			dd: string;
			ddd: string;
			dddd: string;
			ddh: string;
		};
	}) => JSX.Element;

	/** Replace left arrows with custom ones */
	renderLeftArrow?: () => JSX.Element;

	/** Replace right arrows with custom ones */
	renderRightArrow?: () => JSX.Element;

	/** Handler which gets executed when press arrow icon left. It receive a callback can go back month */
	onPressArrowLeft?: (props: {
		prevMonth?: () => void;
		month?: number;
		nextMonth?: () => void;
	}) => void;

	/** Handler which gets executed when press arrow icon right. It receive a callback can go next month */
	onPressArrowRight?: (props: {
		prevMonth?: () => void;
		month?: number;
		nextMonth?: () => void;
	}) => void;

	/** Disable left arrow */
	disableArrowLeft?: boolean;

	/** Disable right arrow */
	disableArrowRight?: boolean;

	/** Minimum date that can be selected, dates before minDate will be grayed out. Format = "DD-MM-YYYY" */
	minDate?: string;

	/** Maximum date that can be selected, dates after maxDate will be grayed out. Format = "DD-MM-YYYY" */
	maxDate?: string;
}

Documentation :

CalendarDateView

PropName PropType Parameters Purpose Default
testId string Unique testid for the component
style. ImageStyle Parent style for the entire component.
isShowGrid boolean Display grid like view around each day true
hideExtraDays boolean Hide previous month & next month's extra days false
hideArrows boolean Hide month & year navigation arrows. false
disableArrowLeft boolean Disable left arrow. false
disableArrowRight boolean Disable right arrow. false
minDate string Minimum date that can be selected, dates before minDate will be grayed out. DD-MM-YYYY
maxDate string Maximum date that can be selected, dates after maxDate will be grayed out. DD-MM-YYYY
onDayPress function { day: number, month: number, year: number } Callback which gets invloked when a date is clicked, The function receives day, month & year as parameter
renderHeader JSX.Element { month: number, monthName: string, year: number, toggleMList: () => void toggleYList: () => void, prevMonth: () => void, nextMonth: () => void } Replace default month and year title with custom one. The function receive a month ,year & other header props as parameter
renderDay JSX.Element { testId: string, index: number, day: DayProps, month: number, year: number, onDayPress: { day: number, month: number, year: number } Render custom day component. the function receive all day props
renderWeekName JSX.Element { testId: string, value: { d: string, dd: string, ddd: string, dddd: string, ddh: string }} Render custom week component. the function receive a all week props
renderLeftArrow JSX.Element Replace left arrows with custom ones
renderRightArrow JSX.Element Replace right arrows with custom ones
onPressArrowLeft function { prevMonth: () => void, month: number, nextMonth: () => void } Handler which gets executed when press arrow icon left. It receive a callback can go back month
onPressArrowRight function { prevMonth: () => void month: number nextMonth: () => void } Handler which gets executed when press arrow icon right. It receive a callback can go next month

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

About Me

Yuvraj Pandey

I am a passionate Engineer which likes to push himself on various fronts of technologies.

For more exciting updates follow me,

                                    

react-native-picker-calendar-view's People

Contributors

yuvraj24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jaskaran-online

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.