A lightweight calendar-component for react-native
source link: https://reactnativeexample.com/a-lightweight-calendar-component-for-react-native/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
react-native-ep-calendar
A lightweight calendar-component for react-native.
1. Installation
react-native-ep-calendar requires react-native >= 0.63.4. It also uses react-native-svg to display icons.
To install simply run
npm install react-native-ep-calendar
in your project. For iOS you need to install the pods:
cd ios && pod install && cd ..
2. Usage
The Calendar component takes some parameters, but they are all optional.
Property Description Default darkTheme A style object defining the dark theme. See 4. Themes. null (predefined style). lightTheme A style object defining the light theme. See 4. Themes. null (predefined style). localization Currently unused null markedDates Array of Objects containing a date property and a markerType as string today with default marker markerTypes Array of Objects containing a string property markerType as identifier and a style object empty array maxDate Max date the user can see. null minDate Min date the user can see null onDayLongPress Callback for a long press on a day null onDayPress Callback for a normal press on a day null onMonthChangeListener Callback when changing the displayed month & year null startDate Starting date of the calendar component today useDarkMode Darkmode for calendar allowed? true2.1 markedDates
Needs an array of objects containing a date and a markerType, for example:
let markedDates = [
{
date: new Date(Date.now()),
markerType: 'myMarker'
},
];
2.2 markerTypes
Needs an array of objects containg a markerType and some style objects:
let markerTypes = [
{
markerType: 'myMarker',
markerTextStyle: {color: 'red'}.
markerTouchableStyle = {backgroundColor: 'transparent'},
markerColumnStyle = null
},
];
2.3 onMonthChangeListener
This callback gets fired, when the users changes the displayed month. The callback receives four parameters:
- previousMonth
- previousYear
- month
In our example that callback is used to load the data for the new month.
3. Example
An example with some properties set:
<Calendar
markerTypes={[missMarker]}
markedDates={[...checkedMarker, ...missedMarkers]}
darkTheme={{
markerColor: habit.Color,
markerTextColor: getTextColorForBgHex(habit.Color),
}}
lightTheme={{
markerColor: habit.Color,
markerTextColor: getTextColorForBgHex(habit.Color),
}}
onMonthChangeListener={(
previousMonth,
previousYear,
month,
year,
) => {
getTimelineData(
habit,
month,
year,
setCheckedMarker,
setMissedMarker,
);
}}
/>
GitHub
Recommend
-
10
React Native Rich Text Editor A fully functional Rich Text Editor for both Android and iOS (macOS and windows)? yarn add react-native-pell-rich-editor or npm i react-native-pell-rich-editor Also, follo...
-
10
React Native Calendar High-quality, modern, fast interactive calendar built specifically with performance in mind. Supports gestures and animations.
-
14
rn-emoji-keyboard A lightweight, fully customizable emoji picker, written as React Native component (without native elements). Designated to be user and developer friendly!
-
3
react-big-calendar An events calendar component built for React and made for modern browsers (read: IE10+) and uses flexbox over the classic tables-ception approach.
-
5
React Native New Feature Simple and lightweight What's New style component that shows your React Native app new features.
-
1
Text Localizer A lightweight, fast and flexible way to handle localized strings. Motivation Text Localizer is a package born out of the need to manage translations in a typesafe manner. Currently, the best-known...
-
4
Calendar A swipeable calendar component for React Native Oct 23, 2021...
-
4
📅 React Native Calendar Kit Calendar component for react native project RPReplay_Final1667537767.MP4 Installation Using Yarn: $ yarn add @howljs/calendar-kit
-
4
react-native-calendar-date-range-picker React native calendar range picker Preview
-
3
React Native Animated Bottom Drawer A lightweight and highly performant bottom drawer for react native Features Extremely lightweight (~15kb) and highly performant Support for snapping (multi level bottom dr...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK