@sekizlipenguen/react-native-splash-helper 0.0.1 → 0.0.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/README.md CHANGED
@@ -71,8 +71,16 @@ npx @sekizlipenguen/react-native-splash-helper generate-splash
71
71
 
72
72
  ---
73
73
 
74
+
74
75
  ## What It Does
75
76
 
77
+ This library handles the splash screen during the app's loading phase:
78
+ - **iOS**: Manages the Launch Screen Storyboard until the app is fully loaded.
79
+ - **Android**: Manages the Splash Activity and its configuration until React Native initializes.
80
+
81
+ Once the app has fully loaded and transitions to the `App.js`, the splash screen is no longer managed by this library. At this point, you can create and display custom screens or animations within your React Native app.
82
+
83
+
76
84
  1. **Android**:
77
85
 
78
86
  - Updates `styles.xml` to include the `android:windowBackground` property for detected themes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekizlipenguen/react-native-splash-helper",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A lightweight React Native library to automatically configure splash screens for both Android and iOS platforms. Simplifies the splash screen setup process for React Native developers.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -23,17 +23,47 @@ function updateStoryboard(iosConfig) {
23
23
  fs.mkdirSync(splashImagePath, { recursive: true });
24
24
  }
25
25
 
26
- // Splash görseli kopyalanıyor
26
+ // Splash görseli kopyalanıyor - Cache sorununu önlemek için rastgele isim kullan
27
27
  const splashImageSource = path.resolve(iosConfig.splashImage);
28
- const splashImageTarget = path.join(splashImagePath, 'splash_image.png');
28
+ // Timestamp ve random sayı ile benzersiz isim oluştur
29
+ const timestamp = Date.now();
30
+ const random = Math.floor(Math.random() * 10000);
31
+ const uniqueImageName = `splash_image_${timestamp}_${random}.png`;
32
+ const splashImageTarget = path.join(splashImagePath, uniqueImageName);
33
+
34
+ // Eski splash_image.png dosyasını sil (varsa)
35
+ const oldImagePath = path.join(splashImagePath, 'splash_image.png');
36
+ if (fs.existsSync(oldImagePath)) {
37
+ fs.unlinkSync(oldImagePath);
38
+ }
39
+
40
+ // Eski rastgele isimli dosyaları temizle (sadece son 5 dosyayı tut)
41
+ try {
42
+ const files = fs.readdirSync(splashImagePath).filter(file =>
43
+ file.startsWith('splash_image_') && file.endsWith('.png') && file !== 'splash_image.png'
44
+ );
45
+ if (files.length > 5) {
46
+ // En eski dosyaları sil (timestamp'e göre sırala)
47
+ files.sort().slice(0, files.length - 5).forEach(file => {
48
+ try {
49
+ fs.unlinkSync(path.join(splashImagePath, file));
50
+ } catch (e) {
51
+ // Silme hatası görmezden gel
52
+ }
53
+ });
54
+ }
55
+ } catch (e) {
56
+ // Dizin okuma hatası görmezden gel
57
+ }
58
+
29
59
  fs.copyFileSync(splashImageSource, splashImageTarget);
30
60
 
31
- // Contents.json dosyasını oluştur
61
+ // Contents.json dosyasını oluştur - Yeni dosya adını kullan
32
62
  const contentsJson = {
33
63
  images: [
34
- { idiom: 'universal', filename: 'splash_image.png', scale: '1x' },
35
- { idiom: 'universal', filename: 'splash_image.png', scale: '2x' },
36
- { idiom: 'universal', filename: 'splash_image.png', scale: '3x' },
64
+ { idiom: 'universal', filename: uniqueImageName, scale: '1x' },
65
+ { idiom: 'universal', filename: uniqueImageName, scale: '2x' },
66
+ { idiom: 'universal', filename: uniqueImageName, scale: '3x' },
37
67
  ],
38
68
  info: { version: 1, author: 'xcode' },
39
69
  };