@onekeyfe/react-native-splash-screen 1.1.22 → 1.1.23
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/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/SplashScreenBridge.kt
CHANGED
|
@@ -56,14 +56,19 @@ object SplashScreenBridge {
|
|
|
56
56
|
onSuccess: ((Boolean) -> Unit)?,
|
|
57
57
|
onFailure: ((String) -> Unit)?
|
|
58
58
|
) {
|
|
59
|
-
isAlreadyHidden = true
|
|
60
59
|
val controller = controllers[activity]
|
|
61
60
|
if (controller == null) {
|
|
62
61
|
OneKeyLog.warn(TAG, "hide: no controller for activity")
|
|
63
62
|
onFailure?.invoke("No splash screen registered for this activity")
|
|
64
63
|
return
|
|
65
64
|
}
|
|
66
|
-
controller.hide(
|
|
65
|
+
controller.hide(
|
|
66
|
+
onSuccess = { result ->
|
|
67
|
+
isAlreadyHidden = true
|
|
68
|
+
onSuccess?.invoke(result)
|
|
69
|
+
},
|
|
70
|
+
onFailure = onFailure
|
|
71
|
+
)
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
private fun createSplashView(activity: Activity): android.view.View? {
|
package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/SplashViewController.kt
CHANGED
|
@@ -32,6 +32,7 @@ internal class SplashViewController(
|
|
|
32
32
|
|
|
33
33
|
private var autoHideEnabled = true
|
|
34
34
|
private var splashShown = false
|
|
35
|
+
private var searchCancelled = false
|
|
35
36
|
|
|
36
37
|
fun show() {
|
|
37
38
|
val activity = weakActivity.get() ?: return
|
|
@@ -64,6 +65,8 @@ internal class SplashViewController(
|
|
|
64
65
|
onFailure?.invoke("Activity is already destroyed")
|
|
65
66
|
return
|
|
66
67
|
}
|
|
68
|
+
searchCancelled = true
|
|
69
|
+
handler.removeCallbacksAndMessages(null)
|
|
67
70
|
Handler(activity.mainLooper).post {
|
|
68
71
|
contentView.removeView(splashView)
|
|
69
72
|
autoHideEnabled = true
|
|
@@ -74,6 +77,13 @@ internal class SplashViewController(
|
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
private fun searchForRootView() {
|
|
80
|
+
if (searchCancelled) return
|
|
81
|
+
val activity = weakActivity.get()
|
|
82
|
+
if (activity == null || activity.isFinishing || activity.isDestroyed) {
|
|
83
|
+
OneKeyLog.warn(TAG, "searchForRootView: activity destroyed, stopping search")
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
if (!splashShown) return
|
|
77
87
|
val found = findRootView(contentView)
|
|
78
88
|
if (found != null) {
|
|
79
89
|
handleRootView(found)
|
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# react-native-splash-screen
|
|
2
|
-
|
|
3
|
-
react-native-splash-screen
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install react-native-splash-screen react-native-nitro-modules
|
|
9
|
-
|
|
10
|
-
> `react-native-nitro-modules` is required as this library relies on [Nitro Modules](https://nitro.margelo.com/).
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import { ReactNativeSplashScreen } from 'react-native-splash-screen';
|
|
17
|
-
|
|
18
|
-
// ...
|
|
19
|
-
|
|
20
|
-
const result = await ReactNativeSplashScreen.hello({ message: 'World' });
|
|
21
|
-
console.log(result); // { success: true, data: 'Hello, World!' }
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Contributing
|
|
25
|
-
|
|
26
|
-
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
27
|
-
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
|
|
28
|
-
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
29
|
-
|
|
30
|
-
## License
|
|
31
|
-
|
|
32
|
-
MIT
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|