@umituz/react-native-design-system 4.25.5 → 4.25.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "4.25.5",
3
+ "version": "4.25.7",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -40,7 +40,6 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@react-native-async-storage/async-storage": "^2.2.0",
43
- "@react-native-community/datetimepicker": "^8.6.0",
44
43
  "react-native-svg": "^15.12.1",
45
44
  "rn-emoji-keyboard": "^1.7.0"
46
45
  },
@@ -93,7 +92,8 @@
93
92
  "react-native": "*",
94
93
  "react-native-gesture-handler": ">=2.20.0",
95
94
  "react-native-safe-area-context": ">=5.6.2",
96
- "zustand": ">=5.0.0"
95
+ "zustand": ">=5.0.0",
96
+ "@react-native-community/datetimepicker": ">=8.0.0"
97
97
  },
98
98
  "peerDependenciesMeta": {
99
99
  "@react-navigation/native": {
@@ -101,6 +101,9 @@
101
101
  },
102
102
  "expo-application": {
103
103
  "optional": true
104
+ },
105
+ "@react-native-community/datetimepicker": {
106
+ "optional": true
104
107
  }
105
108
  },
106
109
  "devDependencies": {
@@ -4,35 +4,9 @@
4
4
  * A reusable date picker component that wraps the native date picker
5
5
  * with consistent styling and behavior across platforms.
6
6
  *
7
- * Features:
8
- * - Platform-specific native pickers (iOS wheel, Android dialog)
9
- * - Consistent styling with design tokens
10
- * - Locale-aware date/time formatting (native Date methods)
11
- * - Timezone-aware (respects device timezone)
12
- * - Automatic language integration (native locale support)
13
- * - Optional label and error states
14
- * - Minimum and maximum date constraints
15
- * - Disabled state support
16
- * - Theme-aware styling
17
- * - Proper keyboard avoidance on iOS
18
- *
19
- * Usage:
20
- * ```tsx
21
- * const [selectedDate, setSelectedDate] = useState(new Date());
22
- *
23
- * <AtomicDatePicker
24
- * value={selectedDate}
25
- * onChange={setSelectedDate}
26
- * label="Birth Date"
27
- * minimumDate={new Date(1900, 0, 1)}
28
- * maximumDate={new Date()}
29
- * />
30
- * ```
31
- *
32
- * Platform Behavior:
33
- * - Opens bottom sheet from bottom with spinner wheel
34
- * - Requires "Done" button to confirm selection
35
- * - Can be dismissed by swiping down or tapping backdrop
7
+ * Requires @react-native-community/datetimepicker as a peer dependency.
8
+ * If not installed, the component will render only the button with a
9
+ * console warning when pressed.
36
10
  *
37
11
  * @module AtomicDatePicker
38
12
  */
@@ -44,7 +18,6 @@ import {
44
18
  type StyleProp,
45
19
  type ViewStyle,
46
20
  } from 'react-native';
47
- import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
48
21
  import { useAppDesignTokens } from '../theme';
49
22
  import { AtomicText } from './AtomicText';
50
23
  import { DatePickerModal } from './datepicker/components/DatePickerModal';
@@ -52,6 +25,18 @@ import { DatePickerButton } from './datepicker/components/DatePickerButton';
52
25
  import { useDatePickerText } from './datepicker/hooks/useDatePickerText';
53
26
  import { getDatePickerStyles } from './datepicker/styles/datePickerStyles';
54
27
 
28
+ let DateTimePicker: any = null;
29
+ try {
30
+ DateTimePicker = require('@react-native-community/datetimepicker').default;
31
+ } catch {
32
+ // Optional peer dependency not installed
33
+ }
34
+
35
+ type DateTimePickerEvent = {
36
+ type: 'set' | 'dismissed' | 'neutralButtonPressed';
37
+ nativeEvent: { timestamp: number; utcOffset: number };
38
+ };
39
+
55
40
  /**
56
41
  * Props for AtomicDatePicker component
57
42
  */
@@ -80,16 +65,6 @@ export interface AtomicDatePickerProps {
80
65
  style?: StyleProp<ViewStyle>;
81
66
  }
82
67
 
83
- /**
84
- * AtomicDatePicker - Universal date/time picker component
85
- *
86
- * Wraps @react-native-community/datetimepicker with:
87
- * - Theme integration
88
- * - Platform-specific modal handling
89
- * - Error states
90
- * - Disabled states
91
- * - Responsive sizing
92
- */
93
68
  export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
94
69
  value,
95
70
  onChange,
@@ -106,10 +81,6 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
106
81
  const tokens = useAppDesignTokens();
107
82
  const [showPicker, setShowPicker] = useState(false);
108
83
 
109
- /**
110
- * Handle date/time change in picker
111
- * On Android, directly apply the change. On iOS, show picker in modal and apply on confirm.
112
- */
113
84
  const handleChange = (event: DateTimePickerEvent, selectedDate?: Date) => {
114
85
  if (Platform.OS === 'android') {
115
86
  setShowPicker(false);
@@ -117,27 +88,24 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
117
88
  onChange(selectedDate);
118
89
  }
119
90
  } else {
120
- // iOS: Update value while picker is open
121
91
  if (event.type === 'set' && selectedDate) {
122
92
  onChange(selectedDate);
123
93
  }
124
- // iOS: Close on dismiss (swipe down)
125
94
  if (event.type === 'dismissed') {
126
95
  setShowPicker(false);
127
96
  }
128
97
  }
129
98
  };
130
99
 
131
- /**
132
- * Handle open - show native picker
133
- */
134
100
  const handleOpen = () => {
135
- if (Platform.OS === 'android') {
136
- setShowPicker(true);
137
- } else {
138
- // iOS: Show picker inline
139
- setShowPicker(true);
101
+ if (!DateTimePicker) {
102
+ console.warn(
103
+ '[AtomicDatePicker] @react-native-community/datetimepicker is not installed. ' +
104
+ 'Install it to use the date picker: npx expo install @react-native-community/datetimepicker'
105
+ );
106
+ return;
140
107
  }
108
+ setShowPicker(true);
141
109
  };
142
110
 
143
111
  const { displayText } = useDatePickerText({ value, placeholder, mode });
@@ -167,19 +135,21 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
167
135
  )}
168
136
 
169
137
  {/* iOS Modal */}
170
- <DatePickerModal
171
- visible={Platform.OS === 'ios' && showPicker}
172
- onClose={() => setShowPicker(false)}
173
- onDateChange={handleChange}
174
- currentDate={value ?? new Date()}
175
- mode={mode}
176
- minimumDate={minimumDate}
177
- maximumDate={maximumDate}
178
- testID={testID}
179
- />
138
+ {DateTimePicker && (
139
+ <DatePickerModal
140
+ visible={Platform.OS === 'ios' && showPicker}
141
+ onClose={() => setShowPicker(false)}
142
+ onDateChange={handleChange}
143
+ currentDate={value ?? new Date()}
144
+ mode={mode}
145
+ minimumDate={minimumDate}
146
+ maximumDate={maximumDate}
147
+ testID={testID}
148
+ />
149
+ )}
180
150
 
181
151
  {/* Android Picker */}
182
- {Platform.OS === 'android' && showPicker && (
152
+ {DateTimePicker && Platform.OS === 'android' && showPicker && (
183
153
  <DateTimePicker
184
154
  value={value ?? new Date()}
185
155
  mode={mode}
@@ -2,7 +2,7 @@
2
2
  * DatePickerModal Component
3
3
  *
4
4
  * Modal component for iOS date picker with proper styling and behavior.
5
- * Extracted from AtomicDatePicker for better separation of concerns.
5
+ * Uses lazy-loaded @react-native-community/datetimepicker (optional peer dependency).
6
6
  */
7
7
 
8
8
  import React, { useMemo } from 'react';
@@ -14,10 +14,21 @@ import {
14
14
  Platform,
15
15
  } from 'react-native';
16
16
  import { useSafeAreaInsets } from '../../../safe-area';
17
- import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
18
17
  import { useAppDesignTokens } from '../../../theme';
19
18
  import { AtomicText } from '../../AtomicText';
20
19
 
20
+ let DateTimePicker: any = null;
21
+ try {
22
+ DateTimePicker = require('@react-native-community/datetimepicker').default;
23
+ } catch {
24
+ // Optional peer dependency not installed
25
+ }
26
+
27
+ type DateTimePickerEvent = {
28
+ type: 'set' | 'dismissed' | 'neutralButtonPressed';
29
+ nativeEvent: { timestamp: number; utcOffset: number };
30
+ };
31
+
21
32
  interface DatePickerModalProps {
22
33
  visible: boolean;
23
34
  onClose: () => void;
@@ -91,7 +102,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
91
102
  },
92
103
  }), [overlayOpacity, tokens, insets.bottom]);
93
104
 
94
- if (Platform.OS !== 'ios') {
105
+ if (Platform.OS !== 'ios' || !DateTimePicker) {
95
106
  return null;
96
107
  }
97
108
 
@@ -140,4 +151,4 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
140
151
  </View>
141
152
  </Modal>
142
153
  );
143
- };
154
+ };
@@ -75,9 +75,9 @@ export async function downloadFileWithProgress(
75
75
  }
76
76
 
77
77
  const totalBytes = parseInt(response.headers.get("content-length") || "0", 10);
78
- if (!response.body) return { ...(await downloadFile(url, destUri)), fromCache: false };
78
+ if (!(response as any).body) return { ...(await downloadFile(url, destUri)), fromCache: false };
79
79
 
80
- const reader = response.body.getReader();
80
+ const reader = (response as any).body.getReader();
81
81
  const chunks: Uint8Array[] = [];
82
82
  let received = 0;
83
83
 
@@ -5,6 +5,8 @@
5
5
 
6
6
  import { File, Paths } from "expo-file-system";
7
7
 
8
+ declare function atob(data: string): string;
9
+
8
10
  /**
9
11
  * Extract raw base64 from data URI
10
12
  */
@@ -5,6 +5,8 @@
5
5
 
6
6
  import { File as ExpoFile, Paths } from "expo-file-system/next";
7
7
 
8
+ declare function atob(data: string): string;
9
+
8
10
  interface FileWithType {
9
11
  readonly type: string;
10
12
  }
@@ -101,7 +101,7 @@ export async function retryWithBackoff<T>(
101
101
  }
102
102
 
103
103
  // Wait before retrying
104
- await new Promise((resolve) => setTimeout(resolve, delay));
104
+ await new Promise<void>((resolve) => setTimeout(() => resolve(), delay));
105
105
  }
106
106
  }
107
107
 
@@ -60,8 +60,8 @@ export class DesignSystemError extends Error {
60
60
  this.retryable = metadata?.retryable ?? false;
61
61
 
62
62
  // Maintains proper stack trace for where our error was thrown (only available on V8)
63
- if (Error.captureStackTrace) {
64
- Error.captureStackTrace(this, DesignSystemError);
63
+ if (typeof (Error as any).captureStackTrace === 'function') {
64
+ (Error as any).captureStackTrace(this, DesignSystemError);
65
65
  }
66
66
  }
67
67
 
@@ -100,8 +100,8 @@ class Logger {
100
100
  * Use for performance measurements
101
101
  */
102
102
  time(label: string): void {
103
- if (this.isDev && console.time) {
104
- console.time(label);
103
+ if (this.isDev && (console as any).time) {
104
+ (console as any).time(label);
105
105
  }
106
106
  }
107
107
 
@@ -109,8 +109,8 @@ class Logger {
109
109
  * End time measurement - only in development
110
110
  */
111
111
  timeEnd(label: string): void {
112
- if (this.isDev && console.timeEnd) {
113
- console.timeEnd(label);
112
+ if (this.isDev && (console as any).timeEnd) {
113
+ (console as any).timeEnd(label);
114
114
  }
115
115
  }
116
116
 
@@ -119,8 +119,8 @@ class Logger {
119
119
  * Use for assertions
120
120
  */
121
121
  assert(condition: boolean, ...args: unknown[]): void {
122
- if (this.isDev && console.assert) {
123
- console.assert(condition, ...args);
122
+ if (this.isDev && (console as any).assert) {
123
+ (console as any).assert(condition, ...args);
124
124
  }
125
125
  }
126
126