react-native-bootsplash 4.3.3 → 4.4.0
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 +9 -6
- package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModule.java +6 -5
- package/dist/commonjs/index.js +6 -4
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/index.js +6 -4
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/index.d.ts +3 -2
- package/dist/typescript/index.d.ts.map +1 -1
- package/ios/.DS_Store +0 -0
- package/ios/RNBootSplash.m +2 -1
- package/package.json +9 -9
- package/src/index.ts +6 -3
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ Show a splash screen during app startup. Hide it when you are ready.<br>
|
|
|
11
11
|
[](https://developer.apple.com/ios)
|
|
12
12
|
|
|
13
13
|
<p>
|
|
14
|
-
<img height="520" src="https://raw.githubusercontent.com/zoontek/react-native-bootsplash/HEAD/docs/ios_demo.gif?raw=true" alt="iOS demo"></img>
|
|
15
|
-
<img height="500" src="https://raw.githubusercontent.com/zoontek/react-native-bootsplash/HEAD/docs/android_demo.gif?raw=true" alt="android demo"></img>
|
|
14
|
+
<img height="520" width="256" src="https://raw.githubusercontent.com/zoontek/react-native-bootsplash/HEAD/docs/ios_demo.gif?raw=true" alt="iOS demo"></img>
|
|
15
|
+
<img height="500" width="259" src="https://raw.githubusercontent.com/zoontek/react-native-bootsplash/HEAD/docs/android_demo.gif?raw=true" alt="android demo"></img>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
## Funding
|
|
@@ -213,7 +213,7 @@ Set the `BootSplash.storyboard` as launch screen file:
|
|
|
213
213
|
|
|
214
214
|
### Android
|
|
215
215
|
|
|
216
|
-
_⚠️ On Android 12, the splash screen will not appear if you start your app from the terminal / Android Studio. To see it, kill your app and restart it in normal conditions (tap on your app icon in the app launcher)._
|
|
216
|
+
_⚠️ On Android >= 12, the splash screen will not appear if you start your app from the terminal / Android Studio. To see it, kill your app and restart it in normal conditions (tap on your app icon in the app launcher)._
|
|
217
217
|
|
|
218
218
|
---
|
|
219
219
|
|
|
@@ -310,16 +310,19 @@ public class MainActivity extends ReactActivity {
|
|
|
310
310
|
#### Method type
|
|
311
311
|
|
|
312
312
|
```ts
|
|
313
|
-
type hide = (config?: { fade?: boolean }) => Promise<void>;
|
|
313
|
+
type hide = (config?: { fade?: boolean, duration?: boolean }) => Promise<void>;
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
+
Note: Only durations above 220ms are visually noticeable. Smaller values will be ignored and the default duration will be used.
|
|
317
|
+
|
|
316
318
|
#### Usage
|
|
317
319
|
|
|
318
320
|
```js
|
|
319
321
|
import RNBootSplash from "react-native-bootsplash";
|
|
320
322
|
|
|
321
323
|
RNBootSplash.hide(); // immediate
|
|
322
|
-
RNBootSplash.hide({ fade: true }); // fade
|
|
324
|
+
RNBootSplash.hide({ fade: true }); // fade with 220ms default duration
|
|
325
|
+
RNBootSplash.hide({ fade: true, duration: 500 }); // fade with custom duration
|
|
323
326
|
```
|
|
324
327
|
|
|
325
328
|
### getVisibilityStatus()
|
|
@@ -353,7 +356,7 @@ function App() {
|
|
|
353
356
|
};
|
|
354
357
|
|
|
355
358
|
init().finally(async () => {
|
|
356
|
-
await RNBootSplash.hide({ fade: true });
|
|
359
|
+
await RNBootSplash.hide({ fade: true, duration: 500 });
|
|
357
360
|
console.log("Bootsplash has been hidden successfully");
|
|
358
361
|
});
|
|
359
362
|
}, []);
|
|
@@ -29,7 +29,6 @@ import java.util.TimerTask;
|
|
|
29
29
|
public class RNBootSplashModule extends ReactContextBaseJavaModule {
|
|
30
30
|
|
|
31
31
|
public static final String NAME = "RNBootSplash";
|
|
32
|
-
private static final int ANIMATION_DURATION = 220;
|
|
33
32
|
|
|
34
33
|
private enum Status {
|
|
35
34
|
VISIBLE,
|
|
@@ -44,6 +43,7 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule {
|
|
|
44
43
|
private static Status mStatus = Status.HIDDEN;
|
|
45
44
|
private static boolean mShouldFade = false;
|
|
46
45
|
private static boolean mShouldKeepOnScreen = true;
|
|
46
|
+
private static int mAnimationDuration;
|
|
47
47
|
|
|
48
48
|
public RNBootSplashModule(ReactApplicationContext reactContext) {
|
|
49
49
|
super(reactContext);
|
|
@@ -80,8 +80,8 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule {
|
|
|
80
80
|
splashScreenView
|
|
81
81
|
.animate()
|
|
82
82
|
// Crappy hack to avoid automatic layout transitions
|
|
83
|
-
.setDuration(mShouldFade ?
|
|
84
|
-
.setStartDelay(mShouldFade ? 0 :
|
|
83
|
+
.setDuration(mShouldFade ? mAnimationDuration: 0)
|
|
84
|
+
.setStartDelay(mShouldFade ? 0 : mAnimationDuration)
|
|
85
85
|
.alpha(0.0f)
|
|
86
86
|
.setInterpolator(new AccelerateInterpolator())
|
|
87
87
|
.setListener(new AnimatorListenerAdapter() {
|
|
@@ -151,14 +151,15 @@ public class RNBootSplashModule extends ReactContextBaseJavaModule {
|
|
|
151
151
|
timer.cancel();
|
|
152
152
|
clearPromiseQueue();
|
|
153
153
|
}
|
|
154
|
-
},
|
|
154
|
+
}, mAnimationDuration);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
@ReactMethod
|
|
161
|
-
public void hide(final boolean fade, final Promise promise) {
|
|
161
|
+
public void hide(final boolean fade, final int fadeDuration, final Promise promise) {
|
|
162
|
+
mAnimationDuration = fadeDuration;
|
|
162
163
|
mPromiseQueue.push(promise);
|
|
163
164
|
hideAndResolveAll(fade);
|
|
164
165
|
}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -8,12 +8,14 @@ exports.getVisibilityStatus = getVisibilityStatus;
|
|
|
8
8
|
exports.hide = hide;
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
const NativeModule = _reactNative.NativeModules.RNBootSplash;
|
|
11
|
+
const DEFAULT_DURATION = 220;
|
|
11
12
|
function hide() {
|
|
12
13
|
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
-
|
|
14
|
-
fade
|
|
15
|
-
|
|
16
|
-
}
|
|
14
|
+
const {
|
|
15
|
+
fade = false,
|
|
16
|
+
duration = DEFAULT_DURATION
|
|
17
|
+
} = config;
|
|
18
|
+
return NativeModule.hide(fade, Math.max(duration, DEFAULT_DURATION)).then(() => {});
|
|
17
19
|
}
|
|
18
20
|
function getVisibilityStatus() {
|
|
19
21
|
return NativeModule.getVisibilityStatus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModule","NativeModules","RNBootSplash","hide","config","fade","then","getVisibilityStatus"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;AAAA;AAKA,MAAMA,YAGL,GAAGC,0BAAa,CAACC,YAAY;
|
|
1
|
+
{"version":3,"names":["NativeModule","NativeModules","RNBootSplash","DEFAULT_DURATION","hide","config","fade","duration","Math","max","then","getVisibilityStatus"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;AAAA;AAKA,MAAMA,YAGL,GAAGC,0BAAa,CAACC,YAAY;AAE9B,MAAMC,gBAAgB,GAAG,GAAG;AAErB,SAASC,IAAI,GAAqC;EAAA,IAApCC,MAAc,uEAAG,CAAC,CAAC;EACtC,MAAM;IAAEC,IAAI,GAAG,KAAK;IAAEC,QAAQ,GAAGJ;EAAiB,CAAC,GAAGE,MAAM;EAC5D,OAAOL,YAAY,CAACI,IAAI,CAACE,IAAI,EAAEE,IAAI,CAACC,GAAG,CAACF,QAAQ,EAAEJ,gBAAgB,CAAC,CAAC,CAACO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACrF;AAEO,SAASC,mBAAmB,GAA8B;EAC/D,OAAOX,YAAY,CAACW,mBAAmB,EAAE;AAC3C;AAAC,eAEc;EACbP,IAAI;EACJO;AACF,CAAC;AAAA"}
|
package/dist/module/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { NativeModules } from "react-native";
|
|
2
2
|
const NativeModule = NativeModules.RNBootSplash;
|
|
3
|
+
const DEFAULT_DURATION = 220;
|
|
3
4
|
export function hide() {
|
|
4
5
|
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5
|
-
|
|
6
|
-
fade
|
|
7
|
-
|
|
8
|
-
}
|
|
6
|
+
const {
|
|
7
|
+
fade = false,
|
|
8
|
+
duration = DEFAULT_DURATION
|
|
9
|
+
} = config;
|
|
10
|
+
return NativeModule.hide(fade, Math.max(duration, DEFAULT_DURATION)).then(() => {});
|
|
9
11
|
}
|
|
10
12
|
export function getVisibilityStatus() {
|
|
11
13
|
return NativeModule.getVisibilityStatus();
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeModule","RNBootSplash","hide","config","fade","then","getVisibilityStatus"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAK5C,MAAMC,YAGL,GAAGD,aAAa,CAACE,YAAY;AAE9B,OAAO,SAASC,IAAI,GAAqC;EAAA,IAApCC,MAAc,uEAAG,CAAC,CAAC;EACtC,
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeModule","RNBootSplash","DEFAULT_DURATION","hide","config","fade","duration","Math","max","then","getVisibilityStatus"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAK5C,MAAMC,YAGL,GAAGD,aAAa,CAACE,YAAY;AAE9B,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,OAAO,SAASC,IAAI,GAAqC;EAAA,IAApCC,MAAc,uEAAG,CAAC,CAAC;EACtC,MAAM;IAAEC,IAAI,GAAG,KAAK;IAAEC,QAAQ,GAAGJ;EAAiB,CAAC,GAAGE,MAAM;EAC5D,OAAOJ,YAAY,CAACG,IAAI,CAACE,IAAI,EAAEE,IAAI,CAACC,GAAG,CAACF,QAAQ,EAAEJ,gBAAgB,CAAC,CAAC,CAACO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACrF;AAEA,OAAO,SAASC,mBAAmB,GAA8B;EAC/D,OAAOV,YAAY,CAACU,mBAAmB,EAAE;AAC3C;AAEA,eAAe;EACbP,IAAI;EACJO;AACF,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type VisibilityStatus = "visible" | "hidden" | "transitioning";
|
|
2
|
+
export type Config = {
|
|
3
3
|
fade?: boolean;
|
|
4
|
+
duration?: number;
|
|
4
5
|
};
|
|
5
6
|
export declare function hide(config?: Config): Promise<void>;
|
|
6
7
|
export declare function getVisibilityStatus(): Promise<VisibilityStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,eAAe,CAAC;AACtE,MAAM,MAAM,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAS3D,wBAAgB,IAAI,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvD;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAE/D;;;;;AAED,wBAGE"}
|
package/ios/.DS_Store
CHANGED
|
Binary file
|
package/ios/RNBootSplash.m
CHANGED
|
@@ -85,6 +85,7 @@ RCT_EXPORT_MODULE();
|
|
|
85
85
|
|
|
86
86
|
RCT_REMAP_METHOD(hide,
|
|
87
87
|
hideWithFade:(BOOL)fade
|
|
88
|
+
duration:(NSInteger)duration
|
|
88
89
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
89
90
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
90
91
|
if (_resolverQueue == nil)
|
|
@@ -104,7 +105,7 @@ RCT_REMAP_METHOD(hide,
|
|
|
104
105
|
_isTransitioning = true;
|
|
105
106
|
|
|
106
107
|
[UIView transitionWithView:_rootView
|
|
107
|
-
duration:0
|
|
108
|
+
duration:duration / 1000.0
|
|
108
109
|
options:UIViewAnimationOptionTransitionCrossDissolve
|
|
109
110
|
animations:^{
|
|
110
111
|
_rootView.loadingView.hidden = YES;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-bootsplash",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
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>",
|
|
@@ -59,20 +59,20 @@
|
|
|
59
59
|
"react-native": ">=0.65.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"fs-extra": "^
|
|
62
|
+
"fs-extra": "^11.1.0",
|
|
63
63
|
"jimp": "^0.16.2",
|
|
64
64
|
"picocolors": "^1.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/fs-extra": "^9.0.13",
|
|
68
|
-
"@types/react-native": "^0.70.
|
|
69
|
-
"lint-staged": "^13.0.
|
|
70
|
-
"prettier": "^2.
|
|
71
|
-
"prettier-plugin-organize-imports": "^3.2.
|
|
68
|
+
"@types/react-native": "^0.70.7",
|
|
69
|
+
"lint-staged": "^13.0.4",
|
|
70
|
+
"prettier": "^2.8.0",
|
|
71
|
+
"prettier-plugin-organize-imports": "^3.2.1",
|
|
72
72
|
"react": "18.1.0",
|
|
73
|
-
"react-native": "0.70.
|
|
74
|
-
"react-native-builder-bob": "^0.20.
|
|
73
|
+
"react-native": "0.70.6",
|
|
74
|
+
"react-native-builder-bob": "^0.20.2",
|
|
75
75
|
"rescript": "^10.0.1",
|
|
76
|
-
"typescript": "^4.
|
|
76
|
+
"typescript": "^4.9.3"
|
|
77
77
|
}
|
|
78
78
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { NativeModules } from "react-native";
|
|
2
2
|
|
|
3
3
|
export type VisibilityStatus = "visible" | "hidden" | "transitioning";
|
|
4
|
-
export type Config = { fade?: boolean };
|
|
4
|
+
export type Config = { fade?: boolean, duration?: number };
|
|
5
5
|
|
|
6
6
|
const NativeModule: {
|
|
7
|
-
hide: (fade: boolean) => Promise<true>;
|
|
7
|
+
hide: (fade: boolean, duration: number) => Promise<true>;
|
|
8
8
|
getVisibilityStatus: () => Promise<VisibilityStatus>;
|
|
9
9
|
} = NativeModules.RNBootSplash;
|
|
10
10
|
|
|
11
|
+
const DEFAULT_DURATION = 220;
|
|
12
|
+
|
|
11
13
|
export function hide(config: Config = {}): Promise<void> {
|
|
12
|
-
|
|
14
|
+
const { fade = false, duration = DEFAULT_DURATION } = config;
|
|
15
|
+
return NativeModule.hide(fade, Math.max(duration, DEFAULT_DURATION)).then(() => {});
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export function getVisibilityStatus(): Promise<VisibilityStatus> {
|