react-native-bootsplash 4.1.3 → 4.1.4
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 +23 -35
- package/android/build.gradle +2 -2
- package/ios/RNBootSplash.h +1 -1
- package/ios/RNBootSplash.m +6 -3
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -97,6 +97,8 @@ public class MainApplication extends Application implements ReactApplication {
|
|
|
97
97
|
|
|
98
98
|
## Setup
|
|
99
99
|
|
|
100
|
+
ℹ️ For `react-native` < `0.68` documentation, check the [`v4.1.3 README.md`](https://github.com/zoontek/react-native-bootsplash/blob/4.1.3/README.md)
|
|
101
|
+
|
|
100
102
|
### Assets generation
|
|
101
103
|
|
|
102
104
|
In order to speed up the setup, we provide a **CLI** to generate assets, create the Android Drawable XML file and the iOS Storyboard file automatically ✨.
|
|
@@ -138,7 +140,7 @@ You might want to use SVG as input file. For that, you can install a CLI tool to
|
|
|
138
140
|
|
|
139
141
|
```bash
|
|
140
142
|
$ brew install librsvg # available on macOS
|
|
141
|
-
$ rsvg-convert -w 3000 bootsplash_logo.svg bootsplash_logo.png # create a large PNG with generous leeway for 4x Android xxxhdpi devices
|
|
143
|
+
$ rsvg-convert -w 3000 bootsplash_logo.svg -o bootsplash_logo.png # create a large PNG with generous leeway for 4x Android xxxhdpi devices
|
|
142
144
|
$ react-native generate-bootsplash bootsplash_logo.png
|
|
143
145
|
$ rm bootsplash_logo.png # optionally, clean up the PNG
|
|
144
146
|
```
|
|
@@ -172,22 +174,20 @@ ios/YourProjectName/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@3x.p
|
|
|
172
174
|
|
|
173
175
|
_⚠️ Only `.storyboard` files are supported ([Apple has deprecated other methods in April 2020](https://developer.apple.com/news/?id=01132020b))._
|
|
174
176
|
|
|
175
|
-
Edit the `ios/YourProjectName/AppDelegate.
|
|
177
|
+
Edit the `ios/YourProjectName/AppDelegate.mm` file:
|
|
176
178
|
|
|
177
179
|
```obj-c
|
|
178
180
|
#import "AppDelegate.h"
|
|
179
|
-
|
|
180
|
-
#import <React/RCTBridge.h>
|
|
181
|
-
#import <React/RCTBundleURLProvider.h>
|
|
182
|
-
#import <React/RCTRootView.h>
|
|
183
|
-
|
|
184
181
|
#import "RNBootSplash.h" // <- add the header import
|
|
185
182
|
|
|
183
|
+
// …
|
|
184
|
+
|
|
186
185
|
@implementation AppDelegate
|
|
187
186
|
|
|
188
187
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
189
188
|
{
|
|
190
189
|
// …
|
|
190
|
+
|
|
191
191
|
rootViewController.view = rootView;
|
|
192
192
|
self.window.rootViewController = rootViewController;
|
|
193
193
|
[self.window makeKeyAndVisible];
|
|
@@ -211,7 +211,7 @@ Set the `BootSplash.storyboard` as launch screen file:
|
|
|
211
211
|
```gradle
|
|
212
212
|
buildscript {
|
|
213
213
|
ext {
|
|
214
|
-
buildToolsVersion = "
|
|
214
|
+
buildToolsVersion = "31.0.0"
|
|
215
215
|
minSdkVersion = 23 // <- AndroidX splashscreen has basic support for 21 (only the background color), so 23 is best
|
|
216
216
|
compileSdkVersion = 31 // <- set at least 31
|
|
217
217
|
targetSdkVersion = 31 // <- set at least 31
|
|
@@ -223,10 +223,9 @@ buildscript {
|
|
|
223
223
|
|
|
224
224
|
```gradle
|
|
225
225
|
dependencies {
|
|
226
|
-
|
|
227
|
-
//noinspection GradleDynamicVersion
|
|
228
|
-
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
226
|
+
// …
|
|
229
227
|
|
|
228
|
+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
|
230
229
|
implementation "androidx.core:core-splashscreen:1.0.0-beta01" // Add this line
|
|
231
230
|
|
|
232
231
|
// …
|
|
@@ -266,18 +265,7 @@ dependencies {
|
|
|
266
265
|
android:roundIcon="@mipmap/ic_launcher_round"
|
|
267
266
|
android:allowBackup="false"
|
|
268
267
|
android:theme="@style/BootTheme"> <!-- Replace @style/AppTheme with @style/BootTheme -->
|
|
269
|
-
|
|
270
|
-
android:name=".MainActivity"
|
|
271
|
-
android:label="@string/app_name"
|
|
272
|
-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
|
273
|
-
android:launchMode="singleTask"
|
|
274
|
-
android:windowSoftInputMode="adjustResize"
|
|
275
|
-
android:exported="true"> <!-- Add android:exported="true" -->
|
|
276
|
-
<intent-filter>
|
|
277
|
-
<action android:name="android.intent.action.MAIN" />
|
|
278
|
-
<category android:name="android.intent.category.LAUNCHER" />
|
|
279
|
-
</intent-filter>
|
|
280
|
-
</activity>
|
|
268
|
+
<!-- … -->
|
|
281
269
|
</application>
|
|
282
270
|
</manifest>
|
|
283
271
|
|
|
@@ -287,23 +275,23 @@ dependencies {
|
|
|
287
275
|
|
|
288
276
|
```java
|
|
289
277
|
import com.facebook.react.ReactActivity;
|
|
290
|
-
import com.facebook.react.ReactActivityDelegate;
|
|
278
|
+
import com.facebook.react.ReactActivityDelegate;
|
|
279
|
+
import com.facebook.react.ReactRootView;
|
|
291
280
|
import com.zoontek.rnbootsplash.RNBootSplash; // <- add this necessary import
|
|
292
281
|
|
|
293
282
|
public class MainActivity extends ReactActivity {
|
|
294
283
|
|
|
295
284
|
// …
|
|
296
285
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
};
|
|
286
|
+
public static class MainActivityDelegate extends ReactActivityDelegate {
|
|
287
|
+
|
|
288
|
+
// …
|
|
289
|
+
|
|
290
|
+
@Override
|
|
291
|
+
protected void loadApp(String appKey) {
|
|
292
|
+
RNBootSplash.init(getPlainActivity()); // <- initialize the splash screen
|
|
293
|
+
super.loadApp(appKey);
|
|
294
|
+
}
|
|
307
295
|
}
|
|
308
296
|
}
|
|
309
297
|
```
|
|
@@ -396,7 +384,7 @@ To add the mocks, create a file _jest/setup.js_ (or any other file name) contain
|
|
|
396
384
|
```js
|
|
397
385
|
jest.mock("react-native-bootsplash", () => {
|
|
398
386
|
return {
|
|
399
|
-
|
|
387
|
+
hide: jest.fn().mockResolvedValueOnce(),
|
|
400
388
|
getVisibilityStatus: jest.fn().mockResolvedValue("hidden"),
|
|
401
389
|
};
|
|
402
390
|
});
|
package/android/build.gradle
CHANGED
|
@@ -12,7 +12,7 @@ buildscript {
|
|
|
12
12
|
mavenCentral()
|
|
13
13
|
}
|
|
14
14
|
dependencies {
|
|
15
|
-
classpath("com.android.tools.build:gradle:
|
|
15
|
+
classpath("com.android.tools.build:gradle:7.0.4")
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ apply plugin: "com.android.library"
|
|
|
21
21
|
|
|
22
22
|
android {
|
|
23
23
|
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
24
|
-
buildToolsVersion safeExtGet("buildToolsVersion", "
|
|
24
|
+
buildToolsVersion safeExtGet("buildToolsVersion", "31.0.0")
|
|
25
25
|
defaultConfig {
|
|
26
26
|
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
27
27
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
package/ios/RNBootSplash.h
CHANGED
package/ios/RNBootSplash.m
CHANGED
|
@@ -20,11 +20,14 @@ RCT_EXPORT_MODULE();
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
+ (void)initWithStoryboard:(NSString * _Nonnull)storyboardName
|
|
23
|
-
rootView:(
|
|
24
|
-
if (rootView == nil ||
|
|
23
|
+
rootView:(UIView * _Nullable)rootView {
|
|
24
|
+
if (rootView == nil ||
|
|
25
|
+
![rootView isKindOfClass:[RCTRootView class]] ||
|
|
26
|
+
_rootView != nil ||
|
|
27
|
+
RCTRunningInAppExtension())
|
|
25
28
|
return;
|
|
26
29
|
|
|
27
|
-
_rootView = rootView;
|
|
30
|
+
_rootView = (RCTRootView *)rootView;
|
|
28
31
|
|
|
29
32
|
[[NSNotificationCenter defaultCenter] removeObserver:rootView
|
|
30
33
|
name:RCTContentDidAppearNotification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-bootsplash",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Display a bootsplash on your app starts. Hide it when you want.",
|
|
6
6
|
"author": "Mathieu Acthernoene <zoontek@gmail.com>",
|
|
@@ -60,19 +60,22 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"chalk": "^4.1.2",
|
|
63
|
-
"fs-extra": "^10.0.
|
|
63
|
+
"fs-extra": "^10.0.1",
|
|
64
64
|
"jimp": "^0.16.1"
|
|
65
65
|
},
|
|
66
|
+
"resolutions": {
|
|
67
|
+
"@types/react": "^17"
|
|
68
|
+
},
|
|
66
69
|
"devDependencies": {
|
|
67
70
|
"@types/fs-extra": "^9.0.13",
|
|
68
|
-
"@types/react-native": "^0.
|
|
69
|
-
"lint-staged": "^12.3.
|
|
70
|
-
"prettier": "^2.
|
|
71
|
+
"@types/react-native": "^0.67.3",
|
|
72
|
+
"lint-staged": "^12.3.7",
|
|
73
|
+
"prettier": "^2.6.1",
|
|
71
74
|
"prettier-plugin-organize-imports": "^2.3.4",
|
|
72
75
|
"react": "^17.0.2",
|
|
73
|
-
"react-native": "^0.
|
|
76
|
+
"react-native": "^0.68.0",
|
|
74
77
|
"react-native-builder-bob": "^0.18.2",
|
|
75
78
|
"rescript": "^9.1.4",
|
|
76
|
-
"typescript": "^4.
|
|
79
|
+
"typescript": "^4.6.3"
|
|
77
80
|
}
|
|
78
81
|
}
|