1.2.2 • Published 3 months ago

react-native-deadsimple-calendar v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

📅💀 react-native-deadsimple-calendar

Version

Need a simple calendar without having to waste time setting up / optimizing?
Then this package is just for you!

Example

or if you prefer the inline strip version:

Alt text

Don't like adding dependencies to your project?
Feel free to copy paste the code from my github & leave a ⭐

Advantages ✨

  1. Ready to go out of the box 🚀
  2. Highly customizable 🔧
  3. Externally changeable date 🪄
  4. Memoized to improve performance ⚡

Examples

Minimal:

import React from 'react';
import { View } from 'react-native';
import Calendar from 'react-native-deadsimple-calendar';

export default function App() {
  return (<View>

      <Calendar/>

    </View>);
}

Minimal Inline Strip:

import React from 'react';
import { View } from 'react-native';
import Calendar from 'react-native-deadsimple-calendar';

export default function App() {
  return (<View>

      <Calendar
        InlineStrip={true}
      />

    </View>);
}

Customizing:

const MyHeader=()=>(<View>...</View>)


export default function App() {

  const calendarRef = useRef()

  return (<>

    <Button title='Change the date' onPress={() => {
      calendarRef.current.setDate(13, 2, 2003)
    }} />

    <Calendar

      ref={calendarRef}

      style={{
        borderWidth: 3,
        borderColor: 'black',
      }}

      // CustomHeader={MyHeader}
      MarkedDates={{ "2023-00-13": [{ color: "red" }] }}

      OnMonthYearChange={(newMonthYear) => {
        console.log(newMonthYear)
      }}

      OnDateChange={(newDate) => {
        console.log(newDate)
      }}
    />
  </>);
}

Hint 💡
You can use OnTitlePress to create a custom popup to change the month & year.

( Check out this example )

API

PropsTypeExample
MarkedDatesObject{ "2023-00-13": [{ color: "red" }, { color: "green" }] }
DaysListArrayDefault: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
MonthsListArrayDefault: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
InlineStripBooleanDefault: false
OnTitlePressFunction()=>{}
OnMonthYearChangeFunction(newMonthYear) => {}
OnDateChangeFunction(newDate) => {}
refuseRefref.current.setDate(date, month, year) ref.current.getDate()
CustomTitleComponent
CustomRightArrowComponent
CustomLeftArrowComponent
CustomHeaderComponent
styleObject
HeaderStyleObject
TitleStyleObject
RightArrowWrapperStyleObject
RightArrowStyleObject
LeftArrowWrapperStyleObject
LeftArrowStyleObject
WeekItemsWrapperStyleObject
WeekItemstyleObject
DayContainerStyleObject
DayStyleObject
TodayStyleObject
SelectedStyleObject
WeekendStyleObject
WeekStyleObject
DayWrapperStyleObject
SelectedWrapperStyleObject
MarkerWrapperStyleObject
MarkerStyleObject

Feedback / Bug report

If you find any bugs or want to leave a feedback, my email is on my github bio
Always open to constructive criticism 😁