react-native-bootsplash 4.0.0 → 4.1.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.
- package/README.md +4 -4
- package/RNBootSplash.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModule.java +14 -16
- package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashQueue.java +31 -0
- package/ios/RNBootSplash.m +7 -9
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -28,9 +28,9 @@ Show a bootsplash during app startup. Hide it when you are ready.<br>
|
|
|
28
28
|
## Installation
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
$ npm install --save react-native-bootsplash
|
|
31
|
+
$ npm install --save react-native-bootsplash
|
|
32
32
|
# --- or ---
|
|
33
|
-
$ yarn add react-native-bootsplash
|
|
33
|
+
$ yarn add react-native-bootsplash
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Don't forget going into the `ios` directory to execute a `pod install`.
|
|
@@ -110,7 +110,7 @@ $ yarn react-native generate-bootsplash --help
|
|
|
110
110
|
The command can take multiple arguments:
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
|
-
react-native generate-bootsplash <logoPath>
|
|
113
|
+
yarn react-native generate-bootsplash <logoPath>
|
|
114
114
|
|
|
115
115
|
Generate a launch screen using an original logo file
|
|
116
116
|
|
|
@@ -216,7 +216,7 @@ dependencies {
|
|
|
216
216
|
//noinspection GradleDynamicVersion
|
|
217
217
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
218
218
|
|
|
219
|
-
implementation "androidx.core:core-splashscreen:1.0.0-
|
|
219
|
+
implementation "androidx.core:core-splashscreen:1.0.0-beta01" // Add this line
|
|
220
220
|
|
|
221
221
|
// …
|
|
222
222
|
```
|
package/RNBootSplash.podspec
CHANGED
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
s.homepage = package["homepage"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios => "11.0" }
|
|
14
|
+
s.platforms = { :ios => "11.0", :tvos => "11.0" }
|
|
15
15
|
s.requires_arc = true
|
|
16
16
|
|
|
17
17
|
s.source = { :git => package["repository"]["url"], :tag => s.version }
|
package/android/build.gradle
CHANGED
|
@@ -49,5 +49,5 @@ repositories {
|
|
|
49
49
|
dependencies {
|
|
50
50
|
//noinspection GradleDynamicVersion
|
|
51
51
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
52
|
-
implementation "androidx.core:core-splashscreen:${safeExtGet("androidXSplashScreenVersion", "1.0.0-
|
|
52
|
+
implementation "androidx.core:core-splashscreen:${safeExtGet("androidXSplashScreenVersion", "1.0.0-beta01")}"
|
|
53
53
|
}
|
|
@@ -21,7 +21,6 @@ import com.facebook.react.bridge.UiThreadUtil;
|
|
|
21
21
|
import com.facebook.react.common.ReactConstants;
|
|
22
22
|
import com.facebook.react.module.annotations.ReactModule;
|
|
23
23
|
|
|
24
|
-
import java.util.ArrayList;
|
|
25
24
|
import java.util.Timer;
|
|
26
25
|
import java.util.TimerTask;
|
|
27
26
|
|
|
@@ -40,9 +39,9 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule implements Li
|
|
|
40
39
|
@Nullable
|
|
41
40
|
private static SplashScreen mSplashScreen = null;
|
|
42
41
|
|
|
43
|
-
private static final
|
|
42
|
+
private static final RNBootSplashQueue<RNBootSplashTask> mTaskQueue = new RNBootSplashQueue<>();
|
|
44
43
|
private static Status mStatus = Status.HIDDEN;
|
|
45
|
-
private static boolean
|
|
44
|
+
private static boolean mIsAppInForeground = true;
|
|
46
45
|
private static boolean mShouldFade = false;
|
|
47
46
|
private static boolean mShouldKeepOnScreen = true;
|
|
48
47
|
|
|
@@ -67,7 +66,7 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule implements Li
|
|
|
67
66
|
mSplashScreen = SplashScreen.installSplashScreen(activity);
|
|
68
67
|
mStatus = Status.VISIBLE;
|
|
69
68
|
|
|
70
|
-
mSplashScreen.
|
|
69
|
+
mSplashScreen.setKeepOnScreenCondition(new SplashScreen.KeepOnScreenCondition() {
|
|
71
70
|
@Override
|
|
72
71
|
public boolean shouldKeepOnScreen() {
|
|
73
72
|
return mShouldKeepOnScreen;
|
|
@@ -99,29 +98,28 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule implements Li
|
|
|
99
98
|
|
|
100
99
|
@Override
|
|
101
100
|
public void onHostDestroy() {
|
|
102
|
-
|
|
101
|
+
mIsAppInForeground = false;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
@Override
|
|
106
105
|
public void onHostPause() {
|
|
107
|
-
|
|
106
|
+
mIsAppInForeground = false;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
@Override
|
|
111
110
|
public void onHostResume() {
|
|
112
|
-
|
|
111
|
+
mIsAppInForeground = true;
|
|
113
112
|
shiftNextTask();
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
private void shiftNextTask() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|| mTaskQueue.isEmpty();
|
|
116
|
+
if (mStatus != Status.TRANSITIONING && mIsAppInForeground) {
|
|
117
|
+
RNBootSplashTask task = mTaskQueue.shift();
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
if (task != null) {
|
|
120
|
+
hideWithTask(task);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
private void waitAndRetry() {
|
|
@@ -170,8 +168,8 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule implements Li
|
|
|
170
168
|
@Override
|
|
171
169
|
public void run() {
|
|
172
170
|
mStatus = Status.HIDDEN;
|
|
173
|
-
promise.resolve(true);
|
|
174
171
|
timer.cancel();
|
|
172
|
+
promise.resolve(true);
|
|
175
173
|
shiftNextTask();
|
|
176
174
|
}
|
|
177
175
|
}, ANIMATION_DURATION);
|
|
@@ -184,7 +182,7 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule implements Li
|
|
|
184
182
|
if (mSplashScreen == null || mStatus == Status.HIDDEN) {
|
|
185
183
|
promise.resolve(true);
|
|
186
184
|
} else {
|
|
187
|
-
mTaskQueue.
|
|
185
|
+
mTaskQueue.push(new RNBootSplashTask(fade, promise));
|
|
188
186
|
shiftNextTask();
|
|
189
187
|
}
|
|
190
188
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
package com.zoontek.rnbootsplash;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
|
|
6
|
+
import java.util.Vector;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents a first-in-first-out (FIFO) thread safe queue of objects.
|
|
10
|
+
* Its source code is based on Java internal <code>Stack</code>.
|
|
11
|
+
*/
|
|
12
|
+
public class RNBootSplashQueue<E> extends Vector<E> {
|
|
13
|
+
|
|
14
|
+
public RNBootSplashQueue() {}
|
|
15
|
+
|
|
16
|
+
@Nullable
|
|
17
|
+
public synchronized E shift() {
|
|
18
|
+
if (size() == 0) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
E item = elementAt(0);
|
|
23
|
+
removeElementAt(0);
|
|
24
|
+
|
|
25
|
+
return item;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public void push(@NonNull E item) {
|
|
29
|
+
addElement(item);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/ios/RNBootSplash.m
CHANGED
|
@@ -85,16 +85,14 @@ RCT_EXPORT_MODULE();
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
+ (void)shiftNextTask {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (_status != RNBootSplashStatusTransitioning &&
|
|
89
|
+
[_taskQueue count] > 0 &&
|
|
90
|
+
[[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
|
|
91
|
+
RNBootSplashTask *task = [_taskQueue objectAtIndex:0];
|
|
92
|
+
[_taskQueue removeObjectAtIndex:0];
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
RNBootSplashTask *task = [_taskQueue objectAtIndex:0];
|
|
95
|
-
[_taskQueue removeObjectAtIndex:0];
|
|
96
|
-
|
|
97
|
-
return [self hideWithTask:task];
|
|
94
|
+
[self hideWithTask:task];
|
|
95
|
+
}
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
+ (void)hideWithTask:(RNBootSplashTask *)task {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-bootsplash",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
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>",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/fs-extra": "^9.0.13",
|
|
68
|
-
"@types/react-native": "^0.66.
|
|
69
|
-
"lint-staged": "^12.
|
|
70
|
-
"prettier": "^2.
|
|
68
|
+
"@types/react-native": "^0.66.12",
|
|
69
|
+
"lint-staged": "^12.1.7",
|
|
70
|
+
"prettier": "^2.5.1",
|
|
71
71
|
"prettier-plugin-organize-imports": "^2.3.4",
|
|
72
72
|
"react": "^17.0.2",
|
|
73
|
-
"react-native": "^0.66.
|
|
73
|
+
"react-native": "^0.66.4",
|
|
74
74
|
"react-native-builder-bob": "^0.18.2",
|
|
75
75
|
"rescript": "^9.1.4",
|
|
76
|
-
"typescript": "^4.
|
|
76
|
+
"typescript": "^4.5.4"
|
|
77
77
|
}
|
|
78
78
|
}
|