react-native-custom-splash 2.1.3 → 2.1.5

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.3",
3
+ "version": "2.1.5",
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",
@@ -437,44 +437,81 @@ const withSplashScreenIOS = (config, pluginConfig) => {
437
437
  const iosProjectPath = config.modRequest.platformProjectRoot;
438
438
  const projectName = config.modRequest.projectName;
439
439
 
440
- // Step 1: Update Info.plist
440
+ // Step 1: Update Info.plist to use LaunchScreen
441
441
  const infoPlistPath = path.join(iosProjectPath, projectName, 'Info.plist');
442
442
  if (fs.existsSync(infoPlistPath)) {
443
443
  let infoPlist = fs.readFileSync(infoPlistPath, 'utf8');
444
+
445
+ // Update to use LaunchScreen
444
446
  if (!infoPlist.includes('<key>UILaunchStoryboardName</key>')) {
445
447
  infoPlist = infoPlist.replace('</dict>\n</plist>', '\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n</dict>\n</plist>');
448
+ } else {
449
+ // Update existing value to LaunchScreen
450
+ infoPlist = infoPlist.replace(
451
+ /<key>UILaunchStoryboardName<\/key>\s*<string>.*?<\/string>/,
452
+ '<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>'
453
+ );
446
454
  }
455
+
456
+ // Remove UILaunchScreen dictionary if present
447
457
  infoPlist = infoPlist.replace(/<key>UILaunchScreen<\/key>[\s\S]*?<\/dict>/g, '');
458
+
448
459
  fs.writeFileSync(infoPlistPath, infoPlist);
449
460
  }
450
461
 
462
+ // Step 2: Delete old/existing storyboards
463
+ const oldStoryboards = [
464
+ path.join(iosProjectPath, projectName, 'SplashScreen.storyboard'),
465
+ path.join(iosProjectPath, projectName, 'LaunchScreen.storyboard'),
466
+ ];
467
+
468
+ oldStoryboards.forEach(storyPath => {
469
+ if (fs.existsSync(storyPath)) {
470
+ fs.unlinkSync(storyPath);
471
+ console.log(`🗑️ Removed old storyboard: ${path.basename(storyPath)}`);
472
+ }
473
+ });
474
+
475
+ // Step 3: Remove SplashScreenLegacy from Images.xcassets
476
+ const legacyImagePath = path.join(iosProjectPath, projectName, 'Images.xcassets', 'SplashScreenLegacy.imageset');
477
+ if (fs.existsSync(legacyImagePath)) {
478
+ fs.rmSync(legacyImagePath, { recursive: true, force: true });
479
+ console.log('🗑️ Removed SplashScreenLegacy imageset');
480
+ }
481
+
482
+ // Step 4: Copy user images to iOS assets
451
483
  let hasImage = false;
452
484
  let hasLogo = false;
453
485
 
454
486
  if (pluginConfig.image) {
455
487
  hasImage = await copyImageToIOS(projectRoot, pluginConfig.image, 'splash_image', iosProjectPath, projectName);
488
+ if (hasImage) {
489
+ console.log('✅ Background image copied: splash_image');
490
+ }
456
491
  }
492
+
457
493
  if (pluginConfig.logo) {
458
494
  hasLogo = await copyImageToIOS(projectRoot, pluginConfig.logo, 'splash_logo', iosProjectPath, projectName);
495
+ if (hasLogo) {
496
+ console.log('✅ Logo image copied: splash_logo');
497
+ }
459
498
  }
460
499
 
500
+ // Step 5: Create fresh LaunchScreen.storyboard with user images
461
501
  const launchScreenPath = path.join(iosProjectPath, projectName, 'LaunchScreen.storyboard');
462
502
  const storyboardContent = createLaunchScreenStoryboard(hasImage, hasLogo, pluginConfig.backgroundColor);
463
503
  fs.writeFileSync(launchScreenPath, storyboardContent);
464
504
 
465
- const legacyPath = path.join(iosProjectPath, projectName, 'Images.xcassets', 'SplashScreenLegacy.imageset');
466
- if (fs.existsSync(legacyPath)) {
467
- fs.rmSync(legacyPath, { recursive: true, force: true });
468
- console.log('🗑️ Removed SplashScreenLegacy');
469
- }
505
+ console.log('✅ LaunchScreen.storyboard created with YOUR images!');
506
+ console.log(` - Background: ${hasImage ? 'splash_image' : 'color only'}`);
507
+ console.log(` - Logo: ${hasLogo ? 'splash_logo' : 'none'}`);
508
+ console.log(` - Color: ${pluginConfig.backgroundColor}`);
470
509
 
471
- console.log('✅ iOS LaunchScreen configured!');
472
510
  return config;
473
511
  },
474
512
  ]);
475
513
  return config;
476
514
  };
477
- };
478
515
 
479
516
  /**
480
517
  * Main plugin export