nx-react-native-cli 2.7.0 → 2.7.1

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.
Files changed (84) hide show
  1. package/lib/index.cjs +43 -43
  2. package/package.json +1 -1
  3. package/templates/19.7.0/apps/mobile/android/app/src/main/java/com/appsmobile/MainActivity.kt +5 -1
  4. package/templates/19.7.0/apps/mobile/ios/AppsMobile/AppDelegate.mm +6 -0
  5. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png +0 -0
  6. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png +0 -0
  7. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png +0 -0
  8. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png +0 -0
  9. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29.png +0 -0
  10. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png +0 -0
  11. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png +0 -0
  12. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png +0 -0
  13. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png +0 -0
  14. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png +0 -0
  15. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png +0 -0
  16. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png +0 -0
  17. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png +0 -0
  18. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png +0 -0
  19. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png +0 -0
  20. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png +0 -0
  21. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png +0 -0
  22. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png +0 -0
  23. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon@3x.png +0 -0
  24. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png +0 -0
  25. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/AppIcon~ipad.png +0 -0
  26. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/AppIcon.appiconset/Contents.json +134 -0
  27. package/templates/19.7.0/apps/mobile/ios/AppsMobile/Images.xcassets/Contents.json +6 -0
  28. package/templates/21.2.2/apps/mobile/android/app/src/main/java/com/mobile/MainActivity.kt +5 -1
  29. package/templates/21.2.2/apps/mobile/ios/Mobile/AppDelegate.mm +6 -0
  30. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png +0 -0
  31. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png +0 -0
  32. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png +0 -0
  33. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png +0 -0
  34. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29.png +0 -0
  35. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png +0 -0
  36. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png +0 -0
  37. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png +0 -0
  38. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png +0 -0
  39. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png +0 -0
  40. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png +0 -0
  41. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png +0 -0
  42. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png +0 -0
  43. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png +0 -0
  44. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png +0 -0
  45. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png +0 -0
  46. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png +0 -0
  47. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png +0 -0
  48. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon@3x.png +0 -0
  49. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png +0 -0
  50. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/AppIcon~ipad.png +0 -0
  51. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/AppIcon.appiconset/Contents.json +134 -0
  52. package/templates/21.2.2/apps/mobile/ios/Mobile/Images.xcassets/Contents.json +6 -0
  53. package/templates/shared/apps/mobile/android/app/src/main/AndroidManifest.xml +28 -0
  54. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
  55. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  56. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png +0 -0
  57. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  58. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
  59. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  60. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png +0 -0
  61. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  62. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
  63. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  64. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png +0 -0
  65. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  66. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
  67. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  68. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png +0 -0
  69. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  70. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
  71. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  72. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png +0 -0
  73. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  74. package/templates/shared/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
  75. package/templates/shared/apps/mobile/android/app/src/main/res/styles.xml +14 -0
  76. package/templates/shared/apps/mobile/run-android.sh +2 -1
  77. package/templates/shared/apps/mobile/scripts/setup-ios-dev-scheme.rb +101 -1
  78. package/templates/shared/apps/mobile/src/app/index.tsx +3 -39
  79. package/templates/shared/apps/mobile/src/app/query-client.ts +40 -0
  80. package/templates/shared/apps/mobile/src/assets/images/logo.png +0 -0
  81. package/templates/shared/apps/mobile/src/components/atoms/KeyboardAwareScrollView/keyboard-aware-scroll-view.component.tsx +1 -0
  82. package/templates/shared/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +2 -2
  83. package/templates/shared/apps/mobile/src/routes/index.tsx +7 -1
  84. package/templates/shared/apps/mobile/src/assets/images/.gitkeep +0 -0
@@ -157,6 +157,24 @@ def upsert_info_plist_display_name(app_target, ios_dir, project_name)
157
157
  updated
158
158
  end
159
159
 
160
+ def upsert_info_plist_encryption_flag(app_target, ios_dir, project_name)
161
+ paths = resolve_info_plist_paths(app_target, ios_dir, project_name)
162
+ updated = []
163
+
164
+ paths.each do |path|
165
+ next unless File.exist?(path)
166
+
167
+ plist = Xcodeproj::Plist.read_from_path(path) || {}
168
+ next if plist['ITSAppUsesNonExemptEncryption'] == false
169
+
170
+ plist['ITSAppUsesNonExemptEncryption'] = false
171
+ Xcodeproj::Plist.write_to_path(plist, path)
172
+ updated << "Info.plist ITSAppUsesNonExemptEncryption=false at #{path}"
173
+ end
174
+
175
+ updated
176
+ end
177
+
160
178
  def update_scheme_configuration(doc, action_name, build_configuration)
161
179
  action = REXML::XPath.first(doc, "//#{action_name}")
162
180
  raise "Missing #{action_name} in source scheme." unless action
@@ -301,6 +319,81 @@ def upsert_firebase_environment_script_phase(app_target)
301
319
  phase_status
302
320
  end
303
321
 
322
+ def upsert_podfile_node_require_and_permissions(podfile_path)
323
+ return :missing unless File.exist?(podfile_path)
324
+
325
+ content = File.read(podfile_path)
326
+ updated = content.dup
327
+ changes = []
328
+
329
+ # Step 1: Replace old inline require with node_require function if needed
330
+ unless updated.include?('def node_require(script)')
331
+ old_require_pattern = /# Resolve react_native_pods\.rb with node to allow for hoisting\nrequire Pod::Executable\.execute_command\('node', \['-p',\n\s*'require\.resolve\(\n\s*"react-native\/scripts\/react_native_pods\.rb",\n\s*\{paths: \[process\.argv\[1\]\]\},\n\s*\)', __dir__\]\)\.strip/m
332
+
333
+ node_require_block = <<~RUBY.chomp
334
+ def node_require(script)
335
+ # Resolve script with node to allow for hoisting
336
+ require Pod::Executable.execute_command('node', ['-p',
337
+ "require.resolve(
338
+ '\#{script}',
339
+ {paths: [process.argv[1]]},
340
+ )", __dir__]).strip
341
+ end
342
+
343
+ # Use it to require both react-native's and this package's scripts:
344
+ node_require('react-native/scripts/react_native_pods.rb')
345
+ node_require('react-native-permissions/scripts/setup.rb')
346
+ RUBY
347
+
348
+ if updated.match?(old_require_pattern)
349
+ updated.sub!(old_require_pattern, node_require_block)
350
+ changes << 'node_require function (replaced inline require)'
351
+ end
352
+ end
353
+
354
+ # Step 2: Add setup_permissions after prepare_react_native_project! if not present
355
+ unless updated.include?('setup_permissions')
356
+ permissions_block = <<~RUBY
357
+
358
+ # Uncomment the permissions you need
359
+ setup_permissions([
360
+ # 'AppTrackingTransparency',
361
+ # 'Bluetooth',
362
+ # 'Calendars',
363
+ # 'CalendarsWriteOnly',
364
+ # 'Camera',
365
+ # 'Contacts',
366
+ # 'FaceID',
367
+ # 'LocationAccuracy',
368
+ # 'LocationAlways',
369
+ # 'LocationWhenInUse',
370
+ # 'MediaLibrary',
371
+ # 'Microphone',
372
+ # 'Motion',
373
+ 'Notifications',
374
+ # 'PhotoLibrary',
375
+ # 'PhotoLibraryAddOnly',
376
+ # 'Reminders',
377
+ # 'Siri',
378
+ # 'SpeechRecognition',
379
+ # 'StoreKit',
380
+ ])
381
+ RUBY
382
+
383
+ if updated.include?('prepare_react_native_project!')
384
+ updated.sub!(/prepare_react_native_project!\s*\n/) do |match|
385
+ "#{match}#{permissions_block}"
386
+ end
387
+ changes << 'setup_permissions block'
388
+ end
389
+ end
390
+
391
+ return :unchanged if updated == content
392
+
393
+ File.write(podfile_path, updated)
394
+ changes
395
+ end
396
+
304
397
  ios_dir = File.join(Dir.pwd, 'ios')
305
398
  project_path = Dir.glob(File.join(ios_dir, '*.xcodeproj')).first
306
399
  raise 'Could not find an .xcodeproj under ios/.' unless project_path
@@ -330,6 +423,7 @@ changes.concat(upsert_product_bundle_identifier(app_target, base_bundle_identifi
330
423
  base_product_name = extract_base_product_name(app_target)
331
424
  changes.concat(upsert_product_name(app_target, base_product_name))
332
425
  changes.concat(upsert_info_plist_display_name(app_target, ios_dir, project_name))
426
+ changes.concat(upsert_info_plist_encryption_flag(app_target, ios_dir, project_name))
333
427
  firebase_phase_status = upsert_firebase_environment_script_phase(app_target)
334
428
  changes << "Firebase plist run script #{firebase_phase_status}" unless firebase_phase_status == 'existing'
335
429
 
@@ -359,9 +453,15 @@ formatter.write(scheme_doc.root, output)
359
453
  output << "\n"
360
454
  File.write(dev_scheme_path, output)
361
455
 
362
- podfile_status = upsert_podfile_project_mapping(File.join(ios_dir, 'Podfile'), project_name)
456
+ podfile_path = File.join(ios_dir, 'Podfile')
457
+ podfile_status = upsert_podfile_project_mapping(podfile_path, project_name)
363
458
  changes << 'Podfile project mapping' if podfile_status == :updated
364
459
 
460
+ node_require_status = upsert_podfile_node_require_and_permissions(podfile_path)
461
+ if node_require_status.is_a?(Array)
462
+ node_require_status.each { |change| changes << "Podfile #{change}" }
463
+ end
464
+
365
465
  puts 'Configured iOS build configurations and Dev scheme.'
366
466
  if changes.empty?
367
467
  puts 'No new build configurations were created (already configured).'
@@ -1,57 +1,21 @@
1
- import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';
2
- import { QueryClient } from '@tanstack/react-query';
3
- import { AsyncStorage, PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
1
+ import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
4
2
  import React from 'react';
5
3
  import { LogBox } from 'react-native';
6
4
  import { GestureHandlerRootView } from 'react-native-gesture-handler';
7
5
  import 'react-native-get-random-values';
8
6
  import { KeyboardProvider } from 'react-native-keyboard-controller';
9
- import { createMMKV } from 'react-native-mmkv';
10
7
  import { SafeAreaProvider } from 'react-native-safe-area-context';
11
8
  import { useDeviceContext } from 'twrnc';
12
9
 
10
+ import { persistOptions, queryClient } from './query-client';
11
+
13
12
  import { StorageManager } from '@/components';
14
- import CONFIG from '@/config';
15
13
  import ApplicationRoutes from '@/routes';
16
14
  import { tw } from '@/tailwind';
17
15
  import 'react-native-url-polyfill/auto';
18
16
 
19
17
  LogBox.ignoreLogs(['VirtualizedLists', 'onAnimatedValueUpdate']);
20
18
 
21
- const CACHE_TIME = 0;
22
- const STALE_TIME = 0;
23
-
24
- const queryClient = new QueryClient({
25
- defaultOptions: {
26
- queries: {
27
- staleTime: STALE_TIME,
28
- },
29
- },
30
- });
31
-
32
- const storage = createMMKV({
33
- encryptionKey: CONFIG.STORAGE_KEY,
34
- id: 'react-query-persist',
35
- });
36
-
37
- export const MmkvStorage: AsyncStorage = {
38
- getItem: (name) => {
39
- const value = storage.getString(name);
40
-
41
- return value ?? null;
42
- },
43
- removeItem: (name) => {
44
- storage.remove(name);
45
- },
46
- setItem: (name, value) => storage.set(name, value),
47
- };
48
-
49
- const persister = createAsyncStoragePersister({
50
- storage: MmkvStorage as AsyncStorage,
51
- });
52
-
53
- const persistOptions = { maxAge: CACHE_TIME, persister };
54
-
55
19
  function Application() {
56
20
  useDeviceContext(tw, {
57
21
  initialColorScheme: 'light',
@@ -0,0 +1,40 @@
1
+ import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ import { AsyncStorage } from '@tanstack/react-query-persist-client';
4
+ import { createMMKV } from 'react-native-mmkv';
5
+
6
+ import CONFIG from '@/config';
7
+
8
+ const CACHE_TIME = 0;
9
+ const STALE_TIME = 0;
10
+
11
+ export const queryClient = new QueryClient({
12
+ defaultOptions: {
13
+ queries: {
14
+ staleTime: STALE_TIME,
15
+ },
16
+ },
17
+ });
18
+
19
+ const storage = createMMKV({
20
+ encryptionKey: CONFIG.STORAGE_KEY,
21
+ id: 'react-query-persist',
22
+ });
23
+
24
+ export const MmkvStorage: AsyncStorage = {
25
+ getItem: (name) => {
26
+ const value = storage.getString(name);
27
+
28
+ return value ?? null;
29
+ },
30
+ removeItem: (name) => {
31
+ storage.remove(name);
32
+ },
33
+ setItem: (name, value) => storage.set(name, value),
34
+ };
35
+
36
+ const persister = createAsyncStoragePersister({
37
+ storage: MmkvStorage as AsyncStorage,
38
+ });
39
+
40
+ export const persistOptions = { maxAge: CACHE_TIME, persister };
@@ -67,6 +67,7 @@ export function KeyboardAwareScrollView(props: Props) {
67
67
  refreshControl={refreshControl}
68
68
  scrollEventThrottle={16}
69
69
  ScrollViewComponent={ScrollViewComponent}
70
+ showsVerticalScrollIndicator={false}
70
71
  style={style}
71
72
  onScroll={onScroll}
72
73
  {...rest}
@@ -81,7 +81,7 @@ export function ScreenContainer(props: Props) {
81
81
  <KeyboardAwareScrollView
82
82
  containerStyle={defaultContainerStyle}
83
83
  refreshControl={refreshControl as ReactElement<RefreshControlProps>}
84
- scrollViewRef={scrollViewRef}
84
+ scrollViewRef={scrollViewRef as React.RefObject<RNScrollView>}
85
85
  onScroll={onScroll}
86
86
  >
87
87
  {children}
@@ -104,7 +104,7 @@ export function ScreenContainer(props: Props) {
104
104
  <KeyboardAwareScrollView
105
105
  containerStyle={defaultContainerStyle}
106
106
  refreshControl={refreshControl as ReactElement<RefreshControlProps>}
107
- scrollViewRef={scrollViewRef}
107
+ scrollViewRef={scrollViewRef as React.RefObject<RNScrollView>}
108
108
  onScroll={onScroll}
109
109
  >
110
110
  {children}
@@ -2,6 +2,7 @@ import { DefaultTheme, NavigationContainer, Theme } from '@react-navigation/nati
2
2
  import { createNativeStackNavigator } from '@react-navigation/native-stack';
3
3
  import React, { useEffect } from 'react';
4
4
  import { StatusBar } from 'react-native';
5
+ import BootSplash from 'react-native-bootsplash';
5
6
 
6
7
  import CONFIG from '@/config';
7
8
  import { Routes } from '@/routes';
@@ -50,7 +51,12 @@ export default function ApplicationRoutes() {
50
51
  );
51
52
 
52
53
  return (
53
- <NavigationContainer theme={navigationTheme}>
54
+ <NavigationContainer
55
+ theme={navigationTheme}
56
+ onReady={() => {
57
+ BootSplash.hide();
58
+ }}
59
+ >
54
60
  <RootStack.Navigator initialRouteName={initialRouteName} screenOptions={screenOptions}>
55
61
  {screens}
56
62
  </RootStack.Navigator>