react-native-custom-splash 2.1.0 → 2.1.2

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": "react-native-custom-splash",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "A custom splash screen module for React Native with native iOS and Android support, fully compatible with Expo",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -6,6 +6,7 @@ const {
6
6
  AndroidConfig,
7
7
  IOSConfig,
8
8
  } = require('@expo/config-plugins');
9
+ const { withInfoPlist } = IOSConfig.Infoplist || {};
9
10
  const path = require('path');
10
11
  const fs = require('fs');
11
12
 
@@ -430,7 +431,19 @@ function createLaunchScreenStoryboard(hasImage, hasLogo, backgroundColor) {
430
431
  * Plugin to configure iOS splash screen
431
432
  */
432
433
  const withSplashScreenIOS = (config, pluginConfig) => {
433
- return withDangerousMod(config, [
434
+ // Step 1: Update Info.plist to use our LaunchScreen
435
+ config = withInfoPlist(config, (config) => {
436
+ // Set our LaunchScreen as the launch storyboard
437
+ config.modResults.UILaunchStoryboardName = 'LaunchScreen';
438
+
439
+ // Remove Expo's default splash screen configuration
440
+ delete config.modResults.UILaunchScreen;
441
+
442
+ return config;
443
+ });
444
+
445
+ // Step 2: Create our custom LaunchScreen.storyboard and copy images
446
+ config = withDangerousMod(config, [
434
447
  'ios',
435
448
  async (config) => {
436
449
  const projectRoot = config.modRequest.projectRoot;
@@ -476,11 +489,27 @@ const withSplashScreenIOS = (config, pluginConfig) => {
476
489
 
477
490
  fs.writeFileSync(launchScreenPath, storyboardContent);
478
491
 
479
- console.log('✅ iOS LaunchScreen.storyboard created with splash images!');
492
+ // Remove SplashScreenLegacy if it exists (from Expo's default splash)
493
+ const legacyPath = path.join(
494
+ iosProjectPath,
495
+ projectName,
496
+ 'Images.xcassets',
497
+ 'SplashScreenLegacy.imageset'
498
+ );
499
+
500
+ if (fs.existsSync(legacyPath)) {
501
+ fs.rmSync(legacyPath, { recursive: true, force: true });
502
+ console.log('🗑️ Removed SplashScreenLegacy');
503
+ }
504
+
505
+ console.log('✅ iOS LaunchScreen.storyboard created with YOUR images!');
506
+ console.log('✅ Info.plist configured to use LaunchScreen');
480
507
 
481
508
  return config;
482
509
  },
483
510
  ]);
511
+
512
+ return config;
484
513
  };
485
514
 
486
515
  /**
@@ -498,7 +527,6 @@ module.exports = (config, props = {}) => {
498
527
  pluginConfig = getPluginConfig(config);
499
528
  }
500
529
 
501
-
502
530
  return withPlugins(config, [
503
531
  [withSplashScreenAndroid, pluginConfig],
504
532
  [withSplashScreenIOS, pluginConfig],