0.2.12 • Published 1 year ago

@skolacode/react-native-custom-calendar v0.2.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

!! IMPORTANT

This project is still under development, please hold on tight guys. We will release the first version end of DEC 2022**

React Native Custom Calendar

Alt text

A flexible & light weight calendar component for React Native

Installation

Install with npm:

$ npm install --save @skolacode/react-native-custom-calendar

Install with yarn:

$ yarn add @skolacode/react-native-custom-calendar

Usage

Alt text

import React from 'react';
import {View} from 'react-native';
import {CustomCalendar} from '@skolacode/react-native-custom-calendar'

const App = () => {
  return (
    <View>
      <CustomCalendar />
    </View>
  );
};

Props

NameTypeRequiredDefaultDescription
idstringNorandomID of the component as the reference for its ref
dateDateNotodayThe initial date to display active calendar
offsetMonthBooleanNotrueShow the offset previous / next month within Monday to Sunday
expandBooleanNotrueThe state of the calendar view, either expanded or collapsed
showNavBooleanNotrueShow the navigation buttons (only when header is not overwritten)
customHeaderReactElementNo-Custom component to override default header
customDayReactElementNo-Custom component to override default render of each day
handlePressFunctionNo-Custom function to trigger on pressed each day

Component Ref

import React, {useEffect} from 'react';
import {View} from 'react-native';
import {CustomCalendar, CustomCalendarRef} from '@skolacode/react-native-custom-calendar'

const App = () => {
  useEffect(() => {
    CustomCalendarRef.calendarA.collapse();

    console.log(CustomCalendarRef.calendarA.isExpanded()); // false
  }, []);
  
  return (
    <View>
      <CustomCalendar id={'calendarA'} />
    </View>
  );
};

Available properties & methods after component has mounted:

NameTypeReturnDescription
idstringstringReference ID of the component
currentReactElementObjectThe calendar element itself
expandFunctionVoidUpdate the calendar to expanded state
collapseFunctionVoidUpdate the calendar to collapsed state
isExpandedFunctionBooleanGet current state (expanded / collapsed) of the calendar
getCalendarDateFunctionObjectGet details of active current calendar for that month
getSelectedDayFunctionObjectGet details of active selected day
navigatePrevFunctionVoidNavigate calendar to previous month
navigateNextFunctionVoidNavigate calendar to next month
navigateMonthFunctionVoidNavigate calendar to specific month

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago