@imksh/create 1.0.32 → 1.0.33

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.
@@ -6,13 +6,14 @@ import { useColorScheme } from "nativewind";
6
6
  import { Colors } from "../../constants/Colors";
7
7
  import { getTabConfig } from "../../config/tabNavigation";
8
8
  import { LinearGradient } from "expo-linear-gradient";
9
- import type { BottomTabBarProps } from "@react-navigation/bottom-tabs";
9
+ import { Tabs } from "expo-router";
10
10
 
11
11
  interface TabItemProps {
12
12
  isFocused: boolean;
13
- onPress: () => void;
14
- onLongPress: () => void;
13
+ onPress?: () => void;
14
+ onLongPress?: () => void;
15
15
  iconName: keyof typeof Ionicons.glyphMap;
16
+ label?: string;
16
17
  colors: (typeof Colors)[keyof typeof Colors];
17
18
  }
18
19
 
@@ -57,10 +58,12 @@ const TabItem = ({
57
58
  );
58
59
  };
59
60
 
60
- export interface CustomTabBarProps extends BottomTabBarProps {
61
+ export type CustomTabBarProps = Parameters<
62
+ NonNullable<React.ComponentProps<typeof Tabs>["tabBar"]>
63
+ >[0] & {
61
64
  showCenterButton?: boolean;
62
65
  onCenterButtonPress?: () => void;
63
- }
66
+ };
64
67
 
65
68
  export default function CustomTabBar({
66
69
  state,
@@ -74,8 +77,9 @@ export default function CustomTabBar({
74
77
  const colors = Colors[colorScheme ?? "light"];
75
78
 
76
79
  const currentRoute = state.routes[state.index];
77
- const currentOptions = descriptors[currentRoute.key].options;
78
- if (currentOptions.tabBarStyle?.display === "none") {
80
+ const currentOptions = descriptors[currentRoute.key]?.options;
81
+ const flatTabBarStyle = StyleSheet.flatten(currentOptions?.tabBarStyle) as any;
82
+ if (flatTabBarStyle?.display === "none") {
79
83
  return null;
80
84
  }
81
85
 
@@ -112,9 +116,10 @@ export default function CustomTabBar({
112
116
 
113
117
  state.routes.forEach((route, index: number) => {
114
118
  const { options } = descriptors[route.key];
119
+ const flatItemStyle = StyleSheet.flatten(options.tabBarItemStyle) as any;
115
120
  if (
116
- options.href === null ||
117
- options.tabBarItemStyle?.display === "none"
121
+ (options as any).href === null ||
122
+ flatItemStyle?.display === "none"
118
123
  ) {
119
124
  return;
120
125
  }
@@ -1,13 +1,36 @@
1
- import { Platform, Alert } from "react-native";
2
- import {
3
- check,
4
- request,
5
- PERMISSIONS,
6
- RESULTS,
7
- Permission,
8
- PermissionStatus,
9
- openSettings,
10
- } from "react-native-permissions";
1
+ import { Platform, Alert, Linking } from "react-native";
2
+ import { isExpoGo, hasNativeModule } from "@/utils/env";
3
+
4
+ export const RESULTS = {
5
+ UNAVAILABLE: "unavailable",
6
+ DENIED: "denied",
7
+ BLOCKED: "blocked",
8
+ GRANTED: "granted",
9
+ LIMITED: "limited",
10
+ } as const;
11
+
12
+ export type PermissionStatus = (typeof RESULTS)[keyof typeof RESULTS];
13
+ export type Permission = string;
14
+
15
+ export const openSettings = async (): Promise<void> => {
16
+ try {
17
+ await Linking.openSettings();
18
+ } catch (e) {
19
+ console.warn("Failed to open device settings", e);
20
+ }
21
+ };
22
+
23
+ const getRNPModule = () => {
24
+ if (isExpoGo() || !hasNativeModule("RNPermissions")) {
25
+ return null;
26
+ }
27
+ try {
28
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
29
+ return require("react-native-permissions");
30
+ } catch {
31
+ return null;
32
+ }
33
+ };
11
34
 
12
35
  export type AppPermissionType =
13
36
  | "camera"
@@ -27,6 +50,12 @@ class PermissionService {
27
50
  * Helper to determine the correct native Permission object based on platform
28
51
  */
29
52
  private getNativePermission(type: AppPermissionType): Permission | null {
53
+ const rnp = getRNPModule();
54
+ if (!rnp?.PERMISSIONS) {
55
+ return null;
56
+ }
57
+ const { PERMISSIONS } = rnp;
58
+
30
59
  if (Platform.OS === "ios") {
31
60
  switch (type) {
32
61
  case "camera":
@@ -34,10 +63,7 @@ class PermissionService {
34
63
  case "audio":
35
64
  return PERMISSIONS.IOS.MICROPHONE;
36
65
  case "image":
37
- return PERMISSIONS.IOS.PHOTO_LIBRARY;
38
66
  case "file":
39
- // iOS doesn't have a broad "file system" permission for the app sandbox
40
- // Usually handled via DocumentPicker or PhotoLibrary depending on use case.
41
67
  return PERMISSIONS.IOS.PHOTO_LIBRARY;
42
68
  case "location":
43
69
  return PERMISSIONS.IOS.LOCATION_WHEN_IN_USE;
@@ -50,11 +76,7 @@ class PermissionService {
50
76
  case "nearbydevice":
51
77
  return PERMISSIONS.IOS.BLUETOOTH;
52
78
  case "notification":
53
- // handled uniquely by react-native-permissions using requestNotifications
54
- return null;
55
79
  case "phone":
56
- // iOS doesn't require explicit permission to use Linking.openURL('tel:...')
57
- return null;
58
80
  default:
59
81
  return null;
60
82
  }
@@ -77,13 +99,10 @@ class PermissionService {
77
99
  case "calendar":
78
100
  return PERMISSIONS.ANDROID.READ_CALENDAR;
79
101
  case "nearbydevice":
80
- // Required for Android 12+
81
102
  return PERMISSIONS.ANDROID.BLUETOOTH_CONNECT;
82
103
  case "phone":
83
104
  return PERMISSIONS.ANDROID.CALL_PHONE;
84
105
  case "notification":
85
- // handled uniquely by checkNotifications/requestNotifications
86
- return null;
87
106
  default:
88
107
  return null;
89
108
  }
@@ -91,24 +110,101 @@ class PermissionService {
91
110
  return null;
92
111
  }
93
112
 
113
+ /**
114
+ * Fallback for checking permissions in Expo Go using Expo APIs
115
+ */
116
+ private async checkExpoPermission(type: AppPermissionType): Promise<PermissionStatus> {
117
+ try {
118
+ if (type === "notification") {
119
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
120
+ const Notifications = require("expo-notifications");
121
+ const { status } = await Notifications.getPermissionsAsync();
122
+ return status === "granted" ? RESULTS.GRANTED : RESULTS.DENIED;
123
+ }
124
+
125
+ if (type === "location" || type === "locationAlways") {
126
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
127
+ const Location = require("expo-location");
128
+ const { status } = await Location.getForegroundPermissionsAsync();
129
+ return status === "granted" ? RESULTS.GRANTED : RESULTS.DENIED;
130
+ }
131
+
132
+ if (type === "camera" || type === "image") {
133
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
134
+ const ImagePicker = require("expo-image-picker");
135
+ const { status } =
136
+ type === "camera"
137
+ ? await ImagePicker.getCameraPermissionsAsync()
138
+ : await ImagePicker.getMediaLibraryPermissionsAsync();
139
+ return status === "granted" ? RESULTS.GRANTED : RESULTS.DENIED;
140
+ }
141
+ } catch {
142
+ return RESULTS.GRANTED;
143
+ }
144
+
145
+ return RESULTS.GRANTED;
146
+ }
147
+
148
+ /**
149
+ * Fallback for requesting permissions in Expo Go using Expo APIs
150
+ */
151
+ private async requestExpoPermission(type: AppPermissionType): Promise<PermissionStatus> {
152
+ try {
153
+ if (type === "notification") {
154
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
155
+ const Notifications = require("expo-notifications");
156
+ const { status } = await Notifications.requestPermissionsAsync();
157
+ return status === "granted" ? RESULTS.GRANTED : RESULTS.DENIED;
158
+ }
159
+
160
+ if (type === "location" || type === "locationAlways") {
161
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
162
+ const Location = require("expo-location");
163
+ const { status } = await Location.requestForegroundPermissionsAsync();
164
+ return status === "granted" ? RESULTS.GRANTED : RESULTS.DENIED;
165
+ }
166
+
167
+ if (type === "camera" || type === "image") {
168
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
169
+ const ImagePicker = require("expo-image-picker");
170
+ const { status } =
171
+ type === "camera"
172
+ ? await ImagePicker.requestCameraPermissionsAsync()
173
+ : await ImagePicker.requestMediaLibraryPermissionsAsync();
174
+ return status === "granted" ? RESULTS.GRANTED : RESULTS.DENIED;
175
+ }
176
+ } catch {
177
+ return RESULTS.GRANTED;
178
+ }
179
+
180
+ return RESULTS.GRANTED;
181
+ }
182
+
94
183
  /**
95
184
  * Check the current status of a permission without asking the user
96
185
  */
97
186
  async checkPermission(type: AppPermissionType): Promise<PermissionStatus> {
187
+ const rnp = getRNPModule();
188
+ if (isExpoGo() || !rnp) {
189
+ return this.checkExpoPermission(type);
190
+ }
191
+
98
192
  if (type === "notification") {
99
- // eslint-disable-next-line @typescript-eslint/no-require-imports
100
- const { checkNotifications } = require("react-native-permissions");
101
- const { status } = await checkNotifications();
102
- return status;
193
+ try {
194
+ const { status } = await rnp.checkNotifications();
195
+ return status as PermissionStatus;
196
+ } catch {
197
+ return this.checkExpoPermission(type);
198
+ }
103
199
  }
104
-
200
+
105
201
  const nativePerm = this.getNativePermission(type);
106
202
  if (!nativePerm) {
107
- // If the permission doesn't exist on this platform (e.g. Phone on iOS), we consider it granted
108
203
  return RESULTS.GRANTED;
109
204
  }
205
+
110
206
  try {
111
- return await check(nativePerm);
207
+ return (await rnp.check(nativePerm as any)) as PermissionStatus;
112
208
  } catch (error) {
113
209
  console.error(`Error checking permission ${type}:`, error);
114
210
  return RESULTS.UNAVAILABLE;
@@ -119,19 +215,27 @@ class PermissionService {
119
215
  * Request a permission from the user
120
216
  */
121
217
  async requestPermission(type: AppPermissionType): Promise<PermissionStatus> {
218
+ const rnp = getRNPModule();
219
+ if (isExpoGo() || !rnp) {
220
+ return this.requestExpoPermission(type);
221
+ }
222
+
122
223
  if (type === "notification") {
123
- // eslint-disable-next-line @typescript-eslint/no-require-imports
124
- const { requestNotifications } = require("react-native-permissions");
125
- const { status } = await requestNotifications(["alert", "sound", "badge"]);
126
- return status;
224
+ try {
225
+ const { status } = await rnp.requestNotifications(["alert", "sound", "badge"]);
226
+ return status as PermissionStatus;
227
+ } catch {
228
+ return this.requestExpoPermission(type);
229
+ }
127
230
  }
128
231
 
129
232
  const nativePerm = this.getNativePermission(type);
130
233
  if (!nativePerm) {
131
234
  return RESULTS.GRANTED;
132
235
  }
236
+
133
237
  try {
134
- return await request(nativePerm);
238
+ return (await rnp.request(nativePerm as any)) as PermissionStatus;
135
239
  } catch (error) {
136
240
  console.error(`Error requesting permission ${type}:`, error);
137
241
  return RESULTS.UNAVAILABLE;
@@ -152,7 +256,14 @@ class PermissionService {
152
256
  }
153
257
 
154
258
  /**
155
- * Helper to open the OS Settings screen for the app if permission is blocked
259
+ * Opens the OS Settings screen for the app
260
+ */
261
+ async openSettings(): Promise<void> {
262
+ return openSettings();
263
+ }
264
+
265
+ /**
266
+ * Helper to show an alert and open the OS Settings screen for the app if permission is blocked
156
267
  */
157
268
  async openSettingsForApp(
158
269
  title = "Permission Required",
@@ -160,15 +271,26 @@ class PermissionService {
160
271
  ) {
161
272
  Alert.alert(title, message, [
162
273
  { text: "Cancel", style: "cancel" },
163
- { text: "Open Settings", onPress: () => openSettings() },
274
+ {
275
+ text: "Open Settings",
276
+ onPress: () => {
277
+ openSettings();
278
+ },
279
+ },
164
280
  ]);
165
281
  }
282
+
166
283
  /**
167
284
  * Utility to register and fetch the Expo Push Token for this device.
168
285
  * This uses the unified PermissionService to request the notification permission.
169
286
  * NOTE: This will only return a token on physical devices.
170
287
  */
171
288
  async registerForPushNotificationsAsync(): Promise<string | null> {
289
+ // In Expo Go on Android, FCM push notifications are not supported
290
+ if (isExpoGo() && Platform.OS === "android") {
291
+ return null;
292
+ }
293
+
172
294
  // eslint-disable-next-line @typescript-eslint/no-require-imports
173
295
  const Device = require("expo-device");
174
296
  // eslint-disable-next-line @typescript-eslint/no-require-imports
@@ -185,25 +307,29 @@ class PermissionService {
185
307
 
186
308
  // Set channel for Android
187
309
  if (Platform.OS === "android") {
188
- Notifications.setNotificationChannelAsync("default", {
189
- name: "default",
190
- importance: Notifications.AndroidImportance.MAX,
191
- vibrationPattern: [0, 250, 250, 250],
192
- lightColor: "#FF231F7C",
193
- });
310
+ try {
311
+ await Notifications.setNotificationChannelAsync("default", {
312
+ name: "default",
313
+ importance: Notifications.AndroidImportance.MAX,
314
+ vibrationPattern: [0, 250, 250, 250],
315
+ lightColor: "#FF231F7C",
316
+ });
317
+ } catch {
318
+ // Channel setup may fail in Expo Go
319
+ }
194
320
  }
195
321
 
196
322
  try {
197
323
  const projectId =
198
324
  require("../../app.json")?.expo?.extra?.eas?.projectId;
199
-
325
+
200
326
  const tokenData = await Notifications.getExpoPushTokenAsync({
201
327
  projectId,
202
328
  });
203
329
 
204
330
  return tokenData.data;
205
331
  } catch (e) {
206
- console.error("Failed to get push token", e);
332
+ console.warn("Failed to get push token", e);
207
333
  return null;
208
334
  }
209
335
  }
@@ -4,6 +4,7 @@ import Constants from "expo-constants";
4
4
  import { Platform } from "react-native";
5
5
  import { getSocket } from "../services/socket.service";
6
6
  import { toast } from "../utils/toast";
7
+ import { isExpoGo } from "@/utils/env";
7
8
 
8
9
  export interface AppNotification {
9
10
  id: string;
@@ -91,8 +92,7 @@ export const useNotificationStore = create<NotificationState>((set, get) => ({
91
92
  registerForPushNotificationsAsync: async () => {
92
93
  let token: string | undefined;
93
94
 
94
- const isExpoGo = Constants.appOwnership === "expo";
95
- if (isExpoGo && Platform.OS === "android") {
95
+ if (isExpoGo() && Platform.OS === "android") {
96
96
  return;
97
97
  }
98
98
 
@@ -0,0 +1,47 @@
1
+ import Constants, { ExecutionEnvironment } from "expo-constants";
2
+ import { TurboModuleRegistry, NativeModules } from "react-native";
3
+
4
+ /**
5
+ * Checks whether a specific native module or TurboModule is linked in the native binary.
6
+ * Uses non-throwing lookups on both TurboModuleRegistry and NativeModules.
7
+ */
8
+ export const hasNativeModule = (name: string): boolean => {
9
+ try {
10
+ if (TurboModuleRegistry?.get && TurboModuleRegistry.get(name) != null) {
11
+ return true;
12
+ }
13
+ if (NativeModules && NativeModules[name] != null) {
14
+ return true;
15
+ }
16
+ } catch {
17
+ return false;
18
+ }
19
+ return false;
20
+ };
21
+
22
+ /**
23
+ * Returns true if the app is currently running inside Expo Go.
24
+ * Robust against early bundle evaluation where Constants.appOwnership may be null/undefined.
25
+ */
26
+ export const isExpoGo = (): boolean => {
27
+ try {
28
+ // Legacy appOwnership check (SDK < 50 or when populated)
29
+ if (Constants.appOwnership === "expo") {
30
+ return true;
31
+ }
32
+ // Modern execution environment check (SDK 50+)
33
+ if (Constants.executionEnvironment === ExecutionEnvironment.StoreClient) {
34
+ return true;
35
+ }
36
+ // Fallback: Check if custom third-party native modules absent in Expo Go are missing
37
+ const hasRNPermissions = hasNativeModule("RNPermissions");
38
+ const hasRNGoogleSignin = hasNativeModule("RNGoogleSignin");
39
+
40
+ if (!hasRNPermissions && !hasRNGoogleSignin) {
41
+ return true;
42
+ }
43
+ } catch {
44
+ return true;
45
+ }
46
+ return false;
47
+ };
@@ -1,6 +1,6 @@
1
1
  import { Platform } from "react-native";
2
2
  import { toast } from "./toast";
3
- import * as FileSystem from "expo-file-system/legacy";
3
+ import * as FileSystem from "expo-file-system";
4
4
  import * as Sharing from "expo-sharing";
5
5
 
6
6
  /**
@@ -30,7 +30,7 @@ export const downloadFileString = async (
30
30
  const byteArray = new Uint8Array(byteNumbers);
31
31
  byteArrays.push(byteArray);
32
32
  }
33
- blob = new Blob(byteArrays, { type: mimeType });
33
+ blob = new Blob(byteArrays as any, { type: mimeType });
34
34
  } else {
35
35
  blob = new Blob([content], { type: mimeType });
36
36
  }
@@ -1,61 +1,62 @@
1
1
  {
2
- "name": "mobile",
2
+ "name": "Mobile",
3
3
  "main": "expo-router/entry",
4
4
  "version": "1.0.0",
5
5
  "dependencies": {
6
- "@expo/ui": "~57.0.7",
6
+ "@expo/ui": "~57.0.22",
7
7
  "@expo/vector-icons": "^15.1.1",
8
8
  "@react-native-async-storage/async-storage": "2.2.0",
9
9
  "@react-native-community/slider": "^5.2.0",
10
+ "@react-native-google-signin/google-signin": "^13.1.0",
10
11
  "@react-native-picker/picker": "^2.11.4",
11
12
  "@react-navigation/bottom-tabs": "^7.18.10",
12
- "@tanstack/react-query": "^5.101.4",
13
13
  "axios": "^1.18.1",
14
14
  "babel-preset-expo": "^57.0.3",
15
- "dayjs": "^1.11.21",
15
+ "dayjs": "^1.11.13",
16
16
  "drizzle-orm": "^0.45.2",
17
- "expo": "~57.0.7",
18
- "expo-blur": "~57.0.2",
17
+ "expo": "~57.0.27",
18
+ "expo-blur": "~57.0.3",
19
19
  "expo-constants": "~57.0.6",
20
- "expo-device": "~57.0.1",
21
- "expo-file-system": "~18.0.7",
22
- "expo-sharing": "~13.0.1",
20
+ "expo-device": "~57.0.2",
21
+ "expo-file-system": "~57.0.7",
23
22
  "expo-font": "~57.0.1",
24
- "expo-glass-effect": "~57.0.1",
25
- "expo-image": "~57.0.1",
26
- "expo-image-picker": "~57.0.7",
27
- "expo-linear-gradient": "^57.0.1",
28
- "expo-linking": "~57.0.3",
29
- "expo-location": "~57.0.7",
30
- "expo-notifications": "~57.0.6",
31
- "expo-router": "~57.0.7",
32
- "expo-splash-screen": "~57.0.4",
33
- "expo-sqlite": "^57.0.1",
23
+ "expo-glass-effect": "~57.0.4",
24
+ "expo-image": "~57.0.5",
25
+ "expo-image-picker": "~57.0.20",
26
+ "expo-linear-gradient": "~57.0.2",
27
+ "expo-linking": "~57.0.12",
28
+ "expo-local-authentication": "~57.0.3",
29
+ "expo-location": "~57.0.20",
30
+ "expo-notifications": "~57.0.22",
31
+ "expo-router": "~57.0.25",
32
+ "expo-sharing": "~57.0.22",
33
+ "expo-splash-screen": "~57.0.9",
34
+ "expo-sqlite": "~57.0.4",
34
35
  "expo-status-bar": "~57.0.1",
35
- "expo-symbols": "~57.0.1",
36
- "expo-system-ui": "~57.0.1",
37
- "expo-web-browser": "~57.0.1",
38
- "lottie-react": "^2.4.1",
36
+ "expo-symbols": "~57.0.3",
37
+ "expo-system-ui": "~57.0.4",
38
+ "expo-web-browser": "~57.0.3",
39
39
  "lottie-react-native": "^7.3.8",
40
40
  "nativewind": "^4.2.6",
41
41
  "prettier-plugin-tailwindcss": "^0.5.14",
42
42
  "react": "19.2.3",
43
43
  "react-dom": "19.2.3",
44
- "react-native": "0.86.0",
44
+ "react-native": "0.86.3",
45
+ "react-native-blob-util": "^0.19.11",
45
46
  "react-native-gesture-handler": "~2.32.0",
46
47
  "react-native-image-viewing": "^0.2.2",
47
48
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
48
- "react-native-maps": "1.27.2",
49
49
  "react-native-otp-entry": "^1.8.6",
50
50
  "react-native-paper": "^5.15.3",
51
+ "react-native-pdf": "^7.0.5",
51
52
  "react-native-permissions": "^5.6.0",
52
- "react-native-reanimated": "^4.5.2",
53
- "react-native-safe-area-context": "^5.8.0",
54
- "react-native-screens": "4.25.2",
53
+ "react-native-reanimated": "4.5.1",
54
+ "react-native-safe-area-context": "~5.7.0",
55
+ "react-native-screens": "~4.26.0",
55
56
  "react-native-toast-message": "^2.4.0",
56
57
  "react-native-web": "~0.21.0",
57
58
  "react-native-webview": "13.16.1",
58
- "react-native-worklets": "0.10.0",
59
+ "react-native-worklets": "0.10.1",
59
60
  "socket.io-client": "^4.8.3",
60
61
  "tailwindcss": "^3.4.19",
61
62
  "zustand": "^5.0.14"
@@ -66,7 +67,7 @@
66
67
  "dpdm": "^3.14.0",
67
68
  "drizzle-kit": "^0.31.10",
68
69
  "eslint": "^9.0.0",
69
- "eslint-config-expo": "~57.0.0",
70
+ "eslint-config-expo": "~57.0.2",
70
71
  "prettier": "^3.4.2",
71
72
  "ts-prune": "^0.10.3",
72
73
  "typescript": "~6.0.3"
@@ -83,8 +84,7 @@
83
84
  "format": "prettier --write \"src/**/*.{ts,tsx,json}\"",
84
85
  "format:check": "prettier --check \"src/**/*.{ts,tsx,json}\"",
85
86
  "circular-check": "dpdm --circular --no-warning --no-tree --exit-code circular:1 \"src/**/*.{ts,tsx}\"",
86
- "ts-prune": "ts-prune",
87
- "ts-purns": "ts-prune",
87
+ "prune:unused": "ts-prune",
88
88
  "ts:check": "tsc --noEmit",
89
89
  "build": "eas build",
90
90
  "build:android": "eas build -p android",