A minimal Hijri (Islamic) calendar home-screen widget for iOS and Android, plus a tiny companion app screen. The widget shows the day number inside a black circle; tapping opens the app, where the full Hijri date (weekday, month name, year, plus Arabic) is shown below the same circle.
Hijri dates use the Umm al-Qura calendar, computed natively on each platform:
| Platform | Source of truth |
|---|---|
| iOS | Calendar(identifier: .islamicUmmAlQura) (Foundation) |
| Android | android.icu.util.IslamicCalendar (ICU) |
| JS / app | Intl.DateTimeFormat('…-u-ca-islamic-umalqura') |
The native widgets do not depend on JS — they keep working when the app process isn't running.
.
├── App.tsx, index.ts Expo RN entry + main screen
├── src/hijri.ts JS Hijri helpers (Intl)
├── ios-widget/ Drop into Xcode widget extension target
│ ├── HijriWidget.swift
│ ├── HijriWidgetBundle.swift
│ └── Info.plist
└── android-widget/ Drop into android/app/src/main/
├── HijriWidgetProvider.kt → java/com/example/hijri/widget/
├── res/layout/hijri_widget.xml
├── res/drawable/circle_bg.xml
├── res/xml/hijri_widget_info.xml
└── AndroidManifest.snippet.xml
npm install
npm start # then press i for iOS, a for AndroidThis runs only the companion app — adding the home-screen widget itself requires the two wire-up steps below (because WidgetKit / AppWidget targets live outside the Expo JS bundle).
npx expo prebuildto generate theios/folder.- Open
ios/HijriWidgetApp.xcworkspacein Xcode. - File → New → Target → Widget Extension. Name it
HijriWidget. Untick "Include Live Activity" and "Include Configuration App Intent" — not needed. - Delete the auto-generated
.swiftfiles in the new target, then add the files fromios-widget/to that target (drag into Xcode, ensure target membership is only the widget extension, not the main app). - Replace the generated
Info.plistwith the one inios-widget/Info.plist. - Build and run the main app once on a device/simulator, then long-press the home screen → add the Hijri widget.
npx expo prebuildto generate theandroid/folder.- Copy
android-widget/HijriWidgetProvider.ktintoandroid/app/src/main/java/com/example/hijri/widget/(create thewidgetsubpackage). Adjust the package name if you changedandroid.packageinapp.json. - Copy:
res/layout/hijri_widget.xml→android/app/src/main/res/layout/res/drawable/circle_bg.xml→android/app/src/main/res/drawable/res/xml/hijri_widget_info.xml→android/app/src/main/res/xml/
- Paste the
<receiver>block fromAndroidManifest.snippet.xmlinside the<application>tag ofandroid/app/src/main/AndroidManifest.xml. npm run android. Long-press the home screen → Widgets → Hijri.
- iOS — WidgetKit timeline; we schedule the next reload at the upcoming midnight.
- Android —
updatePeriodMillis="86400000"(24 h), the minimum the system honours viaAppWidgetProvider. If you need sub-day precision, schedule aWorkManagerjob from the provider. - Tapping the widget on either platform launches the app; the in-app screen toggles the full date on tap of the same circle.
Issues and pull requests are welcome. Please keep changes focused — this project deliberately stays small and dependency-light.
MIT © lAvArt Studio