@izonnet-web-solution/react-native-date-time-picker-kit 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DateTimePickerKit.podspec +22 -0
- package/LICENSE +20 -0
- package/README.md +532 -2
- package/android/build.gradle +36 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/datetimepickerkit/DatePickerHelper.kt +185 -0
- package/android/src/main/java/com/datetimepickerkit/DateTimePickerHelper.kt +214 -0
- package/android/src/main/java/com/datetimepickerkit/DateTimePickerKitModule.kt +258 -0
- package/android/src/main/java/com/datetimepickerkit/DateTimePickerKitPackage.kt +30 -0
- package/android/src/main/java/com/datetimepickerkit/TimePickerHelper.kt +208 -0
- package/ios/DateTimePickerKit.h +11 -0
- package/ios/DateTimePickerKit.mm +84 -0
- package/ios/DateTimePickerModule.swift +474 -0
- package/lib/module/NativeDateTimePickerKit.js +5 -0
- package/lib/module/NativeDateTimePickerKit.js.map +1 -0
- package/lib/module/components/CalendarPicker.js +414 -0
- package/lib/module/components/CalendarPicker.js.map +1 -0
- package/lib/module/components/ClockPicker.js +273 -0
- package/lib/module/components/ClockPicker.js.map +1 -0
- package/lib/module/components/DatePicker.js +174 -0
- package/lib/module/components/DatePicker.js.map +1 -0
- package/lib/module/components/DateRangePicker.js +154 -0
- package/lib/module/components/DateRangePicker.js.map +1 -0
- package/lib/module/components/DateTimePicker.js +598 -0
- package/lib/module/components/DateTimePicker.js.map +1 -0
- package/lib/module/components/MonthPicker.js +145 -0
- package/lib/module/components/MonthPicker.js.map +1 -0
- package/lib/module/components/TimePicker.js +140 -0
- package/lib/module/components/TimePicker.js.map +1 -0
- package/lib/module/components/TimeSlotPicker.js +118 -0
- package/lib/module/components/TimeSlotPicker.js.map +1 -0
- package/lib/module/components/WheelPicker.js +138 -0
- package/lib/module/components/WheelPicker.js.map +1 -0
- package/lib/module/components/YearPicker.js +151 -0
- package/lib/module/components/YearPicker.js.map +1 -0
- package/lib/module/components/common/ModalWrapper.js +130 -0
- package/lib/module/components/common/ModalWrapper.js.map +1 -0
- package/lib/module/components/common/PickerHeader.js +82 -0
- package/lib/module/components/common/PickerHeader.js.map +1 -0
- package/lib/module/components/common/PresetsBar.js +66 -0
- package/lib/module/components/common/PresetsBar.js.map +1 -0
- package/lib/module/errors/DateTimePickerError.js +12 -0
- package/lib/module/errors/DateTimePickerError.js.map +1 -0
- package/lib/module/hooks/useDateTimePicker.js +73 -0
- package/lib/module/hooks/useDateTimePicker.js.map +1 -0
- package/lib/module/index.js +40 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/localization/index.js +6 -0
- package/lib/module/localization/index.js.map +1 -0
- package/lib/module/localization/locales.js +186 -0
- package/lib/module/localization/locales.js.map +1 -0
- package/lib/module/localization/types.js +2 -0
- package/lib/module/localization/types.js.map +1 -0
- package/lib/module/localization/useLocale.js +126 -0
- package/lib/module/localization/useLocale.js.map +1 -0
- package/lib/module/native/NativeDateTimePicker.js +110 -0
- package/lib/module/native/NativeDateTimePicker.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/presets/datePresets.js +75 -0
- package/lib/module/presets/datePresets.js.map +1 -0
- package/lib/module/presets/index.js +4 -0
- package/lib/module/presets/index.js.map +1 -0
- package/lib/module/slots/index.js +4 -0
- package/lib/module/slots/index.js.map +1 -0
- package/lib/module/slots/timeSlots.js +59 -0
- package/lib/module/slots/timeSlots.js.map +1 -0
- package/lib/module/theme/defaultTheme.js +91 -0
- package/lib/module/theme/defaultTheme.js.map +1 -0
- package/lib/module/theme/index.js +6 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/types.js +2 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/useTheme.js +59 -0
- package/lib/module/theme/useTheme.js.map +1 -0
- package/lib/module/types/events.js +4 -0
- package/lib/module/types/events.js.map +1 -0
- package/lib/module/types/index.js +7 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/native.js +2 -0
- package/lib/module/types/native.js.map +1 -0
- package/lib/module/types/presentation.js +2 -0
- package/lib/module/types/presentation.js.map +1 -0
- package/lib/module/types/props.js +4 -0
- package/lib/module/types/props.js.map +1 -0
- package/lib/module/utils/constants.js +14 -0
- package/lib/module/utils/constants.js.map +1 -0
- package/lib/module/utils/dateConversion.js +115 -0
- package/lib/module/utils/dateConversion.js.map +1 -0
- package/lib/module/utils/dateFormatting.js +102 -0
- package/lib/module/utils/dateFormatting.js.map +1 -0
- package/lib/module/utils/dateValidation.js +161 -0
- package/lib/module/utils/dateValidation.js.map +1 -0
- package/lib/module/utils/index.js +7 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeDateTimePickerKit.d.ts +17 -0
- package/lib/typescript/src/NativeDateTimePickerKit.d.ts.map +1 -0
- package/lib/typescript/src/components/CalendarPicker.d.ts +35 -0
- package/lib/typescript/src/components/CalendarPicker.d.ts.map +1 -0
- package/lib/typescript/src/components/ClockPicker.d.ts +22 -0
- package/lib/typescript/src/components/ClockPicker.d.ts.map +1 -0
- package/lib/typescript/src/components/DatePicker.d.ts +32 -0
- package/lib/typescript/src/components/DatePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/DateRangePicker.d.ts +41 -0
- package/lib/typescript/src/components/DateRangePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/DateTimePicker.d.ts +7 -0
- package/lib/typescript/src/components/DateTimePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/MonthPicker.d.ts +21 -0
- package/lib/typescript/src/components/MonthPicker.d.ts.map +1 -0
- package/lib/typescript/src/components/TimePicker.d.ts +25 -0
- package/lib/typescript/src/components/TimePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/TimeSlotPicker.d.ts +18 -0
- package/lib/typescript/src/components/TimeSlotPicker.d.ts.map +1 -0
- package/lib/typescript/src/components/WheelPicker.d.ts +17 -0
- package/lib/typescript/src/components/WheelPicker.d.ts.map +1 -0
- package/lib/typescript/src/components/YearPicker.d.ts +14 -0
- package/lib/typescript/src/components/YearPicker.d.ts.map +1 -0
- package/lib/typescript/src/components/common/ModalWrapper.d.ts +10 -0
- package/lib/typescript/src/components/common/ModalWrapper.d.ts.map +1 -0
- package/lib/typescript/src/components/common/PickerHeader.d.ts +13 -0
- package/lib/typescript/src/components/common/PickerHeader.d.ts.map +1 -0
- package/lib/typescript/src/components/common/PresetsBar.d.ts +12 -0
- package/lib/typescript/src/components/common/PresetsBar.d.ts.map +1 -0
- package/lib/typescript/src/errors/DateTimePickerError.d.ts +7 -0
- package/lib/typescript/src/errors/DateTimePickerError.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useDateTimePicker.d.ts +17 -0
- package/lib/typescript/src/hooks/useDateTimePicker.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +23 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/localization/index.d.ts +4 -0
- package/lib/typescript/src/localization/index.d.ts.map +1 -0
- package/lib/typescript/src/localization/locales.d.ts +12 -0
- package/lib/typescript/src/localization/locales.d.ts.map +1 -0
- package/lib/typescript/src/localization/types.d.ts +23 -0
- package/lib/typescript/src/localization/types.d.ts.map +1 -0
- package/lib/typescript/src/localization/useLocale.d.ts +31 -0
- package/lib/typescript/src/localization/useLocale.d.ts.map +1 -0
- package/lib/typescript/src/native/NativeDateTimePicker.d.ts +14 -0
- package/lib/typescript/src/native/NativeDateTimePicker.d.ts.map +1 -0
- package/lib/typescript/src/presets/datePresets.d.ts +8 -0
- package/lib/typescript/src/presets/datePresets.d.ts.map +1 -0
- package/lib/typescript/src/presets/index.d.ts +2 -0
- package/lib/typescript/src/presets/index.d.ts.map +1 -0
- package/lib/typescript/src/slots/index.d.ts +2 -0
- package/lib/typescript/src/slots/index.d.ts.map +1 -0
- package/lib/typescript/src/slots/timeSlots.d.ts +18 -0
- package/lib/typescript/src/slots/timeSlots.d.ts.map +1 -0
- package/lib/typescript/src/theme/defaultTheme.d.ts +9 -0
- package/lib/typescript/src/theme/defaultTheme.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +4 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/types.d.ts +65 -0
- package/lib/typescript/src/theme/types.d.ts.map +1 -0
- package/lib/typescript/src/theme/useTheme.d.ts +4 -0
- package/lib/typescript/src/theme/useTheme.d.ts.map +1 -0
- package/lib/typescript/src/types/events.d.ts +8 -0
- package/lib/typescript/src/types/events.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +5 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/native.d.ts +26 -0
- package/lib/typescript/src/types/native.d.ts.map +1 -0
- package/lib/typescript/src/types/presentation.d.ts +19 -0
- package/lib/typescript/src/types/presentation.d.ts.map +1 -0
- package/lib/typescript/src/types/props.d.ts +68 -0
- package/lib/typescript/src/types/props.d.ts.map +1 -0
- package/lib/typescript/src/utils/constants.d.ts +12 -0
- package/lib/typescript/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/src/utils/dateConversion.d.ts +27 -0
- package/lib/typescript/src/utils/dateConversion.d.ts.map +1 -0
- package/lib/typescript/src/utils/dateFormatting.d.ts +8 -0
- package/lib/typescript/src/utils/dateFormatting.d.ts.map +1 -0
- package/lib/typescript/src/utils/dateValidation.d.ts +46 -0
- package/lib/typescript/src/utils/dateValidation.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +5 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/package.json +183 -4
- package/src/NativeDateTimePickerKit.ts +19 -0
- package/src/components/CalendarPicker.tsx +593 -0
- package/src/components/ClockPicker.tsx +403 -0
- package/src/components/DatePicker.tsx +246 -0
- package/src/components/DateRangePicker.tsx +226 -0
- package/src/components/DateTimePicker.tsx +862 -0
- package/src/components/MonthPicker.tsx +216 -0
- package/src/components/TimePicker.tsx +190 -0
- package/src/components/TimeSlotPicker.tsx +163 -0
- package/src/components/WheelPicker.tsx +199 -0
- package/src/components/YearPicker.tsx +228 -0
- package/src/components/common/ModalWrapper.tsx +184 -0
- package/src/components/common/PickerHeader.tsx +121 -0
- package/src/components/common/PresetsBar.tsx +104 -0
- package/src/errors/DateTimePickerError.ts +29 -0
- package/src/hooks/useDateTimePicker.ts +100 -0
- package/src/index.tsx +92 -0
- package/src/localization/index.ts +3 -0
- package/src/localization/locales.ts +499 -0
- package/src/localization/types.ts +21 -0
- package/src/localization/useLocale.ts +137 -0
- package/src/native/NativeDateTimePicker.ts +154 -0
- package/src/presets/datePresets.ts +97 -0
- package/src/presets/index.ts +1 -0
- package/src/slots/index.ts +1 -0
- package/src/slots/timeSlots.ts +89 -0
- package/src/theme/defaultTheme.ts +102 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/types.ts +70 -0
- package/src/theme/useTheme.ts +75 -0
- package/src/types/events.ts +8 -0
- package/src/types/index.ts +4 -0
- package/src/types/native.ts +28 -0
- package/src/types/presentation.ts +21 -0
- package/src/types/props.ts +104 -0
- package/src/utils/constants.ts +15 -0
- package/src/utils/dateConversion.ts +127 -0
- package/src/utils/dateFormatting.ts +166 -0
- package/src/utils/dateValidation.ts +178 -0
- package/src/utils/index.ts +4 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "DateTimePickerKit"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/Izonnet-Web-Solution/react-native-date-time-picker-kit/react-native-date-time-picker-kit.git", :tag => "v#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
s.swift_version = "5.0"
|
|
19
|
+
s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }
|
|
20
|
+
|
|
21
|
+
install_modules_dependencies(s)
|
|
22
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 IzoMalay
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,533 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @izonnet-web-solution/react-native-date-time-picker-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A complete, ultra-lightweight, customizable React Native Date & Time Picker library powered by **iOS (Swift + UIKit)** and **Android (Kotlin + Android SDK)** native TurboModules, plus a rich suite of pure React Native calendar and modal components.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@izonnet-web-solution/react-native-date-time-picker-kit)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[]()
|
|
8
|
+
[]()
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
1. [Features](#features)
|
|
15
|
+
2. [Platform Support & Architecture](#platform-support--architecture)
|
|
16
|
+
3. [Zero Dependency Policy](#zero-dependency-policy)
|
|
17
|
+
4. [Installation & Setup](#installation--setup)
|
|
18
|
+
- [iOS Setup](#ios-setup)
|
|
19
|
+
- [Android Setup](#android-setup)
|
|
20
|
+
5. [Quick Start](#quick-start)
|
|
21
|
+
6. [Presentation Modes](#presentation-modes)
|
|
22
|
+
7. [Theme System](#theme-system)
|
|
23
|
+
8. [Component Catalog](#component-catalog)
|
|
24
|
+
- [1. `DateTimePicker`](#1-datetimepicker-unified)
|
|
25
|
+
- [2. `DatePicker`](#2-datepicker)
|
|
26
|
+
- [3. `TimePicker`](#3-timepicker)
|
|
27
|
+
- [4. `DateRangePicker`](#4-daterangepicker)
|
|
28
|
+
- [5. `CalendarPicker`](#5-calendarpicker)
|
|
29
|
+
- [6. `MonthPicker`](#6-monthpicker)
|
|
30
|
+
- [7. `YearPicker`](#7-yearpicker)
|
|
31
|
+
- [8. `ClockPicker`](#8-clockpicker)
|
|
32
|
+
- [9. `WheelPicker`](#9-wheelpicker)
|
|
33
|
+
- [10. `TimeSlotPicker`](#10-timeslotpicker)
|
|
34
|
+
9. [Quick Date Presets](#quick-date-presets)
|
|
35
|
+
10. [Appointment Time Slots](#appointment-time-slots)
|
|
36
|
+
11. [Localization & RTL](#localization--rtl)
|
|
37
|
+
12. [Imperative Ref APIs](#imperative-ref-apis)
|
|
38
|
+
13. [Custom Hook (`useDateTimePicker`)](#custom-hook-usedatetimepicker)
|
|
39
|
+
14. [Date Validation & Conversion Utilities](#date-validation--conversion-utilities)
|
|
40
|
+
15. [Error Handling & Error Codes](#error-handling--error-codes)
|
|
41
|
+
16. [Compatibility Matrix](#compatibility-matrix)
|
|
42
|
+
17. [License](#license)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **True Native UI**: Native **Swift** (`UIDatePicker`) on iOS and **Kotlin** (`DatePickerDialog`, `TimePickerDialog`) on Android.
|
|
49
|
+
- **Zero Third-Party Runtime Dependencies**: No Moment.js, Day.js, date-fns, react-native-modal, or community picker wrappers.
|
|
50
|
+
- **TurboModule Architecture**: Typed React Native Codegen specifications with promise-based async operations and UI thread safety.
|
|
51
|
+
- **5 Presentation Modes**:
|
|
52
|
+
- `native`: Platform-native dialogs and sheet modals via TurboModules.
|
|
53
|
+
- `inline`: In-tree custom calendar/clock embedded directly in view hierarchy.
|
|
54
|
+
- `bottom-sheet`: Animated slide-up bottom sheet with grab handle and backdrop dimming.
|
|
55
|
+
- `modal`: Centered dialog with backdrop blur/dim.
|
|
56
|
+
- `fullscreen`: Fullscreen overlay modal.
|
|
57
|
+
- **Theme Engine**: Light mode, Dark mode, Automatic system detection, and custom `ThemeConfig` (colors, typography, spacing, border radii).
|
|
58
|
+
- **10 Specialized Components**: `DateTimePicker`, `DatePicker`, `TimePicker`, `DateRangePicker`, `CalendarPicker`, `MonthPicker`, `YearPicker`, `ClockPicker`, `WheelPicker`, `TimeSlotPicker`.
|
|
59
|
+
- **Advanced Features**: Date range selection, appointment time slot generator, quick presets (Today, Yesterday, Last 7 Days, This Month), marked dates with colored dots and badges.
|
|
60
|
+
- **Comprehensive Localization**: Device locale auto-detection, built-in locale presets (English, Hindi, Gujarati, Spanish, French, German, Arabic, Chinese, Japanese), custom locale overrides, and RTL layout support.
|
|
61
|
+
- **Developer Flexibility**: Declarative component, imperative ref methods, and custom React hook (`useDateTimePicker`).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Platform Support & Architecture
|
|
66
|
+
|
|
67
|
+
| Platform | Native Technology | Architecture | Minimum Version |
|
|
68
|
+
| :--- | :--- | :--- | :--- |
|
|
69
|
+
| **iOS** | Swift 5.0 + UIKit (`UIDatePicker`, `UIViewController`) | TurboModule Spec (Obj-C++ JSI wrapper) | iOS 15.1+ |
|
|
70
|
+
| **Android** | Kotlin 1.9+ + Android SDK (`DatePickerDialog`, `TimePickerDialog`) | TurboModule Spec (JNI C++ / Java wrapper) | Android API 24+ (Android 7.0+) |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Zero Dependency Policy
|
|
75
|
+
|
|
76
|
+
This library maintains **0 runtime dependencies**.
|
|
77
|
+
- All date calculations, range validations, leap-year handling, and token formatting are implemented in pure TypeScript.
|
|
78
|
+
- All animations utilize React Native's built-in `Animated` and native drivers.
|
|
79
|
+
- No heavy date libraries (`moment`, `date-fns`, `dayjs`) are introduced into your bundle.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Installation & Setup
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# npm
|
|
87
|
+
npm install @izonnet-web-solution/react-native-date-time-picker-kit
|
|
88
|
+
|
|
89
|
+
# yarn
|
|
90
|
+
yarn add @izonnet-web-solution/react-native-date-time-picker-kit
|
|
91
|
+
|
|
92
|
+
# pnpm
|
|
93
|
+
pnpm add @izonnet-web-solution/react-native-date-time-picker-kit
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### iOS Setup
|
|
97
|
+
|
|
98
|
+
Install CocoaPods dependencies:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cd ios && pod install
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The podspec automatically configures the Swift TurboModule (`DateTimePickerKitImpl`) and module headers.
|
|
105
|
+
|
|
106
|
+
### Android Setup
|
|
107
|
+
|
|
108
|
+
In your React Native project, ensure New Architecture is enabled (standard in RN 0.76+):
|
|
109
|
+
|
|
110
|
+
```properties
|
|
111
|
+
# android/gradle.properties
|
|
112
|
+
newArchEnabled=true
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Quick Start
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import React, { useState } from 'react';
|
|
121
|
+
import { View, Button, Text } from 'react-native';
|
|
122
|
+
import {
|
|
123
|
+
DateTimePicker,
|
|
124
|
+
formatDate,
|
|
125
|
+
} from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
126
|
+
|
|
127
|
+
export default function BasicExample() {
|
|
128
|
+
const [date, setDate] = useState(new Date());
|
|
129
|
+
const [show, setShow] = useState(false);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<View style={{ padding: 20 }}>
|
|
133
|
+
<Text>Selected: {formatDate(date, 'YYYY-MM-DD')}</Text>
|
|
134
|
+
<Button title="Choose Date" onPress={() => setShow(true)} />
|
|
135
|
+
|
|
136
|
+
{show && (
|
|
137
|
+
<DateTimePicker
|
|
138
|
+
mode="date"
|
|
139
|
+
presentation="native"
|
|
140
|
+
value={date}
|
|
141
|
+
onConfirm={(selectedDate) => {
|
|
142
|
+
setShow(false);
|
|
143
|
+
setDate(selectedDate);
|
|
144
|
+
}}
|
|
145
|
+
onCancel={() => setShow(false)}
|
|
146
|
+
/>
|
|
147
|
+
)}
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Presentation Modes
|
|
156
|
+
|
|
157
|
+
All components support 5 presentation modes via the `presentation` prop:
|
|
158
|
+
|
|
159
|
+
| Mode | Description |
|
|
160
|
+
| :--- | :--- |
|
|
161
|
+
| `'native'` *(default)* | Native OS dialogs/sheets (`UIDatePicker` on iOS, `DatePickerDialog` on Android). |
|
|
162
|
+
| `'bottom-sheet'` | Slide-up bottom sheet with grab handle, backdrop dimming, and header. |
|
|
163
|
+
| `'modal'` | Center-aligned modal dialog. |
|
|
164
|
+
| `'inline'` | Directly rendered into the parent view tree without any modal overlay. |
|
|
165
|
+
| `'fullscreen'` | Fullscreen modal overlay with safe area padding. |
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
<DatePicker
|
|
169
|
+
presentation="bottom-sheet" // or "inline", "modal", "native"
|
|
170
|
+
value={new Date()}
|
|
171
|
+
onConfirmDate={(d) => console.log(d)}
|
|
172
|
+
/>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Theme System
|
|
178
|
+
|
|
179
|
+
Built-in themes support light mode, dark mode, auto system scheme, or customized palettes.
|
|
180
|
+
|
|
181
|
+
### Built-in Modes
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<DateTimePicker theme="light" />
|
|
185
|
+
<DateTimePicker theme="dark" />
|
|
186
|
+
<DateTimePicker theme="auto" /> // Automatically follows device dark mode
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Custom Theme Configuration
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
const customTheme = {
|
|
193
|
+
mode: 'light',
|
|
194
|
+
colors: {
|
|
195
|
+
primary: '#6366F1', // Indigo accent
|
|
196
|
+
selected: '#6366F1',
|
|
197
|
+
selectedText: '#FFFFFF',
|
|
198
|
+
background: '#FAFAFA',
|
|
199
|
+
rangeHighlight: '#E0E7FF',
|
|
200
|
+
},
|
|
201
|
+
borderRadius: {
|
|
202
|
+
lg: 20,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
<CalendarPicker theme={customTheme} />
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Component Catalog
|
|
212
|
+
|
|
213
|
+
### 1. `DateTimePicker` (Unified)
|
|
214
|
+
|
|
215
|
+
The core unified component supporting all modes (`date`, `time`, `datetime`, `countdown`) and presentations.
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
<DateTimePicker
|
|
219
|
+
mode="datetime"
|
|
220
|
+
presentation="bottom-sheet"
|
|
221
|
+
value={new Date()}
|
|
222
|
+
minuteInterval={5}
|
|
223
|
+
onConfirm={(date) => console.log('Confirmed:', date)}
|
|
224
|
+
/>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 2. `DatePicker`
|
|
228
|
+
|
|
229
|
+
Dedicated single date picker component with optional presets.
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
const pickerRef = useRef<DatePickerRef>(null);
|
|
233
|
+
|
|
234
|
+
<DatePicker
|
|
235
|
+
ref={pickerRef}
|
|
236
|
+
presentation="bottom-sheet"
|
|
237
|
+
value={selectedDate}
|
|
238
|
+
showPresets
|
|
239
|
+
onConfirmDate={(date) => setSelectedDate(date)}
|
|
240
|
+
/>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 3. `TimePicker`
|
|
244
|
+
|
|
245
|
+
Dedicated time picker component supporting 12h / 24h formats and minute intervals.
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
<TimePicker
|
|
249
|
+
presentation="modal"
|
|
250
|
+
is24Hour={false}
|
|
251
|
+
minuteInterval={15}
|
|
252
|
+
onConfirmTime={(time) => console.log(time)}
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### 4. `DateRangePicker`
|
|
257
|
+
|
|
258
|
+
Select a start date and an end date with visual range highlighting and quick presets.
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
<DateRangePicker
|
|
262
|
+
presentation="bottom-sheet"
|
|
263
|
+
showPresets
|
|
264
|
+
startDate={range.startDate}
|
|
265
|
+
endDate={range.endDate}
|
|
266
|
+
onConfirmRange={({ startDate, endDate }) => {
|
|
267
|
+
console.log('Range:', startDate, 'to', endDate);
|
|
268
|
+
}}
|
|
269
|
+
/>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### 5. `CalendarPicker`
|
|
273
|
+
|
|
274
|
+
Full-featured inline or standalone calendar component with marked dates and RTL support.
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
<CalendarPicker
|
|
278
|
+
value={new Date()}
|
|
279
|
+
onChange={(d) => console.log(d)}
|
|
280
|
+
markedDates={{
|
|
281
|
+
'2026-11-20': { marked: true, dotColor: '#EF4444' },
|
|
282
|
+
'2026-11-25': { marked: true, dotColor: '#10B981' },
|
|
283
|
+
}}
|
|
284
|
+
firstDayOfWeek={0} // 0 = Sunday, 1 = Monday
|
|
285
|
+
/>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### 6. `MonthPicker`
|
|
289
|
+
|
|
290
|
+
3x4 month selection grid with decade navigation.
|
|
291
|
+
|
|
292
|
+
```tsx
|
|
293
|
+
<MonthPicker
|
|
294
|
+
value={{ year: 2026, month: 10 }}
|
|
295
|
+
onChange={({ year, month, date }) => {
|
|
296
|
+
console.log('Selected Month:', month, 'Year:', year);
|
|
297
|
+
}}
|
|
298
|
+
/>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### 7. `YearPicker`
|
|
302
|
+
|
|
303
|
+
Decade-paginated year selection grid.
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
<YearPicker
|
|
307
|
+
value={2026}
|
|
308
|
+
minYear={2000}
|
|
309
|
+
maxYear={2040}
|
|
310
|
+
onChange={(year) => console.log('Year:', year)}
|
|
311
|
+
/>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 8. `ClockPicker`
|
|
315
|
+
|
|
316
|
+
Interactive 12-hour / 24-hour digital clock picker with segmented hour/minute controls and AM/PM toggles.
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
<ClockPicker
|
|
320
|
+
value={{ hour: 10, minute: 30 }}
|
|
321
|
+
is24Hour={false}
|
|
322
|
+
minuteInterval={5}
|
|
323
|
+
onChange={({ hour, minute, date }) => console.log(hour, minute)}
|
|
324
|
+
/>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 9. `WheelPicker`
|
|
328
|
+
|
|
329
|
+
Zero-dependency, smooth scroll wheel picker built on React Native's `ScrollView`.
|
|
330
|
+
|
|
331
|
+
```tsx
|
|
332
|
+
<WheelPicker
|
|
333
|
+
items={[
|
|
334
|
+
{ label: 'Morning (09:00 AM)', value: 'morning' },
|
|
335
|
+
{ label: 'Afternoon (01:00 PM)', value: 'afternoon' },
|
|
336
|
+
{ label: 'Evening (05:00 PM)', value: 'evening' },
|
|
337
|
+
]}
|
|
338
|
+
selectedValue="morning"
|
|
339
|
+
onChange={(val, index) => console.log(val)}
|
|
340
|
+
/>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### 10. `TimeSlotPicker`
|
|
344
|
+
|
|
345
|
+
Appointment time slot selection grid with auto-generation and disabled slot support.
|
|
346
|
+
|
|
347
|
+
```tsx
|
|
348
|
+
<TimeSlotPicker
|
|
349
|
+
startTime="09:00"
|
|
350
|
+
endTime="17:00"
|
|
351
|
+
intervalMinutes={30}
|
|
352
|
+
disabledSlots={['12:00', '12:30']}
|
|
353
|
+
onSelectSlot={(slot) => console.log('Booked slot:', slot.id)}
|
|
354
|
+
/>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Quick Date Presets
|
|
360
|
+
|
|
361
|
+
Generate standard presets for single dates and date ranges:
|
|
362
|
+
|
|
363
|
+
```tsx
|
|
364
|
+
import {
|
|
365
|
+
getStandardRangePresets,
|
|
366
|
+
getStandardSinglePresets,
|
|
367
|
+
} from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
368
|
+
|
|
369
|
+
// Built-in presets: Today, Yesterday, Last 7 Days, Last 30 Days, This Month, Next Month
|
|
370
|
+
const rangePresets = getStandardRangePresets();
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Appointment Time Slots
|
|
376
|
+
|
|
377
|
+
Generate slots for scheduling workflows:
|
|
378
|
+
|
|
379
|
+
```tsx
|
|
380
|
+
import { generateTimeSlots } from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
381
|
+
|
|
382
|
+
const slots = generateTimeSlots({
|
|
383
|
+
startTime: '09:00',
|
|
384
|
+
endTime: '18:00',
|
|
385
|
+
intervalMinutes: 30,
|
|
386
|
+
disabledSlots: ['13:00', '13:30'], // Lunch break
|
|
387
|
+
is24Hour: false,
|
|
388
|
+
});
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Localization & RTL
|
|
394
|
+
|
|
395
|
+
### Built-in Locales
|
|
396
|
+
|
|
397
|
+
- `en` (English - default)
|
|
398
|
+
- `hi` (Hindi - हिन्दी)
|
|
399
|
+
- `gu` (Gujarati - ગુજરાતી)
|
|
400
|
+
- `es` (Spanish - Español)
|
|
401
|
+
- `fr` (French - Français)
|
|
402
|
+
- `de` (German - Deutsch)
|
|
403
|
+
- `ar` (Arabic - العربية with automatic RTL layout)
|
|
404
|
+
- `zh` (Chinese - 中文)
|
|
405
|
+
- `ja` (Japanese - 日本語)
|
|
406
|
+
|
|
407
|
+
```tsx
|
|
408
|
+
<CalendarPicker locale="hi" />
|
|
409
|
+
<DateTimePicker locale="gu" />
|
|
410
|
+
<CalendarPicker locale="ar" /> // Flips weekday order and navigation arrows for RTL
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Formatted Localized Output
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
import { formatLocalized, hiLocale } from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
417
|
+
|
|
418
|
+
const str = formatLocalized(new Date(), 'DD MMMM YYYY (dddd) A', hiLocale);
|
|
419
|
+
// Output: "19 नवंबर 2026 (गुरुवार) पूर्वाह्न"
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Imperative Ref APIs
|
|
425
|
+
|
|
426
|
+
Control pickers programmatically via React refs:
|
|
427
|
+
|
|
428
|
+
```tsx
|
|
429
|
+
const pickerRef = useRef<DateTimePickerRef>(null);
|
|
430
|
+
|
|
431
|
+
// Open picker
|
|
432
|
+
await pickerRef.current?.open();
|
|
433
|
+
|
|
434
|
+
// Programmatic confirm / cancel / close
|
|
435
|
+
await pickerRef.current?.confirm();
|
|
436
|
+
await pickerRef.current?.cancel();
|
|
437
|
+
await pickerRef.current?.close();
|
|
438
|
+
|
|
439
|
+
// Value access
|
|
440
|
+
const value = pickerRef.current?.getValue();
|
|
441
|
+
pickerRef.current?.setValue(new Date());
|
|
442
|
+
pickerRef.current?.reset();
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## Custom Hook (`useDateTimePicker`)
|
|
448
|
+
|
|
449
|
+
```tsx
|
|
450
|
+
import { useDateTimePicker } from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
451
|
+
|
|
452
|
+
function HookExample() {
|
|
453
|
+
const { ref, open, isOpen } = useDateTimePicker({
|
|
454
|
+
mode: 'date',
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
return (
|
|
458
|
+
<View>
|
|
459
|
+
<Button title={isOpen ? 'Open' : 'Choose'} onPress={() => open()} />
|
|
460
|
+
<DateTimePicker ref={ref} mode="date" />
|
|
461
|
+
</View>
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## Date Validation & Conversion Utilities
|
|
469
|
+
|
|
470
|
+
```tsx
|
|
471
|
+
import {
|
|
472
|
+
validateDate,
|
|
473
|
+
validateDateRange,
|
|
474
|
+
isDateDisabled,
|
|
475
|
+
isWeekdayDisabled,
|
|
476
|
+
validateMinuteInterval,
|
|
477
|
+
formatDate,
|
|
478
|
+
parseDate,
|
|
479
|
+
} from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
480
|
+
|
|
481
|
+
// Check date validity
|
|
482
|
+
validateDate(new Date()); // true
|
|
483
|
+
|
|
484
|
+
// Format using custom tokens
|
|
485
|
+
formatDate(new Date(), 'YYYY-MM-DD hh:mm A'); // "2026-11-19 10:30 AM"
|
|
486
|
+
|
|
487
|
+
// Check disabled dates
|
|
488
|
+
isDateDisabled(new Date(), ['2026-12-25'], [0, 6]); // true if Dec 25 or Weekend
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## Error Handling & Error Codes
|
|
494
|
+
|
|
495
|
+
The library exposes strongly typed `DateTimePickerError` instances:
|
|
496
|
+
|
|
497
|
+
```tsx
|
|
498
|
+
import { DateTimePickerError, type DateTimePickerErrorCode } from '@izonnet-web-solution/react-native-date-time-picker-kit';
|
|
499
|
+
|
|
500
|
+
<DateTimePicker
|
|
501
|
+
onError={(error: DateTimePickerError) => {
|
|
502
|
+
console.error('Picker error code:', error.code);
|
|
503
|
+
console.error('Picker error message:', error.message);
|
|
504
|
+
}}
|
|
505
|
+
/>
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Available error codes:
|
|
509
|
+
- `NATIVE_MODULE_NOT_FOUND`
|
|
510
|
+
- `PICKER_ALREADY_OPEN`
|
|
511
|
+
- `PICKER_NOT_OPEN`
|
|
512
|
+
- `INVALID_DATE`
|
|
513
|
+
- `INVALID_MODE`
|
|
514
|
+
- `INVALID_MINUTE_INTERVAL`
|
|
515
|
+
- `DATE_OUT_OF_RANGE`
|
|
516
|
+
- `UNSUPPORTED_FEATURE`
|
|
517
|
+
- `ACTIVITY_UNAVAILABLE`
|
|
518
|
+
- `PRESENTATION_FAILED`
|
|
519
|
+
- `UNKNOWN_ERROR`
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Compatibility Matrix
|
|
524
|
+
|
|
525
|
+
| Library Version | React Native | iOS | Android | New Architecture |
|
|
526
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
527
|
+
| `1.0.0` | `0.74.0` – `0.88.x+` | iOS 15.1+ | API 24+ (Android 7.0+) | **Yes (Required)** |
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## License
|
|
532
|
+
|
|
533
|
+
MIT © [Izonnet Web Solution](https://github.com/izonnet-web-solution)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
ext.DateTimePickerKit = [
|
|
2
|
+
minSdkVersion: 24,
|
|
3
|
+
compileSdkVersion: 36
|
|
4
|
+
]
|
|
5
|
+
|
|
6
|
+
ext.getExtOrDefault = { prop ->
|
|
7
|
+
if (rootProject.ext.has(prop)) {
|
|
8
|
+
return rootProject.ext.get(prop)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return DateTimePickerKit[prop]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
apply plugin: "com.android.library"
|
|
16
|
+
|
|
17
|
+
if (project.extensions.findByName("kotlin") == null) {
|
|
18
|
+
apply plugin: "kotlin-android"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
23
|
+
|
|
24
|
+
android {
|
|
25
|
+
namespace "com.datetimepickerkit"
|
|
26
|
+
|
|
27
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
28
|
+
|
|
29
|
+
defaultConfig {
|
|
30
|
+
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
dependencies {
|
|
35
|
+
implementation "com.facebook.react:react-android"
|
|
36
|
+
}
|