react-native-taqweem
Version:
**A dual calendar component (Hijri + Gregorian) for React Native** β minimal, customizable, and theme-ready. Perfect for apps needing culturally-aware calendars, Islamic date pickers, or just modern UX flexibility.
194 lines (123 loc) β’ 4.72 kB
Markdown
# react-native-taqweem
**A dual calendar component (Hijri + Gregorian) for React Native** β minimal and customizable.
Perfect for apps needing culturally-aware calendars, Islamic date pickers, or just modern UX flexibility.
## π What is βTaqweemβ?
The word Taqweem (ΨͺΩΩΩΩ
) is Arabic for βcalendarβ or βsystem of timekeeping.β
It refers to how dates are calculated and organized β whether by the moon (Hijri) or the sun (Gregorian).
The name reflects the component's purpose: a culturally-aware dual calendar for modern apps.
## β
**Features**
### π Calendar Modes
- β
Supports both **Hijri** and **Gregorian** calendars
- β
Swappable via `calendarMode` prop (`'hijri' | 'gregorian'`)
---
### π Date Display & Navigation
- β
Displays correct **day grid for the month**
- β
Handles **adjacent days** (padding from prev/next months)
β’ Controlled by `showAdjacentMonths` prop
- β
Month & year **header** with centered title
- β
`<` and `>` arrows to navigate months
- β
Arrows auto-hide when min/max bounds are reached
- β
Supports custom header via `renderHeader` prop
---
### π Selection Logic
- β
Allows selecting a single day
- β
Toggles selection on repeat tap
- β
Disables selection of future dates via `allowFutureDates` prop
- β
Blocks navigation into future if `allowFutureDates === false`
---
### π’ Date Limits
- β
Accepts `minDate` and `maxDate` as prop to restrict navigation & selection
- β
Defaults to:
β’ `minDate`: `'1400-1'` (Hijri) or `'1900-1'` (Gregorian)
β’ `maxDate`: current date + 10 years
---
### π€ Event Emission
- β
`onDateChange` prop to inform parent when a day is selected
β’ Provides:
- `calendarDate`: in current `calendarMode` format
- `gregorianDate`: always in `'YYYY-MM-DD'`
- `hijriDate`: always in `'iYYYY-iM-iD'`
- `momentObj`: full Moment object
## Installation
Install **react-native-taqweem** with npm
```bash
npm install react-native-taqweem
```
## Usage/Examples
```typescript
import React from 'react';
import {StyleSheet, View} from 'react-native';
import {Screen} from '@src/components';
import {DualCalendar} from 'react-native-taqweem';
const Home = () => {
return (
<Screen>
<View style={styles.main}>
// Default calendar mode is gregorian
<DualCalendar />
</View>
</Screen>
);
};
export default Home;
```
You can make the `calendarMode` as hijri to render Hijri calendar.
```typescript
<DualCalendar calendarMode="hijri" />
```
You can configure the theme using `calendarTheme` prop.
```typescript
import {CalendarTheme, DualCalendar} from 'react-native-taqweem';
import {useTheme} from '@src/context/theme-context';
const getCalendarThemeStyles = (theme: 'light' | 'dark') =>
StyleSheet.create<CalendarTheme>({
calendarView: {
backgroundColor: theme === 'light' ? '#f8f9fa' : '#212529',
borderRadius: 16,
},
...
// more configurable properties
const Home = () => {
const {theme, toggleTheme} = useTheme();
const calendarTheme = getCalendarThemeStyles(theme);
return (
<Screen>
<Button title="Toggle Theme" onPress={toggleTheme} />
<View style={styles.main}>
<DualCalendar calendarTheme={calendarTheme} />
</View>
</Screen>
);
};
```
You can customize calendar header
```typescript
<View style={styles.main}>
<DualCalendar
renderHeader={props => <ModernCalendarHeader {...props} />}
calendarMode={calendarMode}
calendarTheme={calendarTheme}
/>
</View>
```
## Screenshots
### Gregorian Calendar

### Hijri Calendar

### Switch between calendar modes

### Configurable Theme and Look

### Customize Header

## Acknowledgements
> Built with β€οΈ using `moment-hijri` under the hood, supports localization, RTL, theming, and full date control.
## Authors
- [@jawadvajeeh](https://www.github.com/jawadvajeeh)
## Contributing
Thank you for your interest in contributing to **react-native-taqweem**! π
If youβd like to suggest a feature, report a bug, or collaborate in any way β
please feel free to get in touch:
π© **jawadvajeeh@gmail.com**
Looking forward to hearing from you!