react-native-bootsplash 6.1.4 → 6.2.0-rc.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.
Files changed (43) hide show
  1. package/README.md +1 -0
  2. package/android/build.gradle +6 -4
  3. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplash.kt +13 -0
  4. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashDialog.kt +79 -0
  5. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModuleImpl.kt +242 -0
  6. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashPackage.kt +37 -0
  7. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashQueue.kt +26 -0
  8. package/android/src/main/res/values/colors.xml +8 -0
  9. package/android/src/main/res/values/styles.xml +13 -13
  10. package/android/src/main/res/values-night/styles.xml +1 -1
  11. package/android/src/main/res/values-v23/styles.xml +2 -2
  12. package/android/src/main/res/values-v29/styles.xml +1 -1
  13. package/android/src/main/res/values-v31/styles.xml +1 -1
  14. package/android/src/newarch/com/zoontek/rnbootsplash/RNBootSplashModule.kt +39 -0
  15. package/android/src/oldarch/com/zoontek/rnbootsplash/RNBootSplashModule.kt +43 -0
  16. package/dist/commonjs/addon/index.js +31 -31
  17. package/dist/commonjs/expo.js +1 -0
  18. package/dist/commonjs/expo.js.map +1 -1
  19. package/dist/commonjs/generate.js +14 -11
  20. package/dist/commonjs/generate.js.map +1 -1
  21. package/dist/commonjs/index.js +13 -4
  22. package/dist/commonjs/index.js.map +1 -1
  23. package/dist/module/addon/index.js +31 -31
  24. package/dist/module/expo.js +1 -0
  25. package/dist/module/expo.js.map +1 -1
  26. package/dist/module/generate.js +14 -11
  27. package/dist/module/generate.js.map +1 -1
  28. package/dist/module/index.js +13 -4
  29. package/dist/module/index.js.map +1 -1
  30. package/dist/typescript/expo.d.ts.map +1 -1
  31. package/dist/typescript/generate.d.ts.map +1 -1
  32. package/dist/typescript/index.d.ts.map +1 -1
  33. package/package.json +7 -6
  34. package/src/expo.ts +1 -0
  35. package/src/generate.ts +22 -17
  36. package/src/index.ts +25 -6
  37. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplash.java +0 -13
  38. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashDialog.java +0 -119
  39. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModuleImpl.java +0 -306
  40. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashPackage.java +0 -46
  41. package/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashQueue.java +0 -31
  42. package/android/src/newarch/com/zoontek/rnbootsplash/RNBootSplashModule.java +0 -51
  43. package/android/src/oldarch/com/zoontek/rnbootsplash/RNBootSplashModule.java +0 -55
package/README.md CHANGED
@@ -203,6 +203,7 @@ Edit the `ios/YourApp/AppDelegate.mm` file:
203
203
 
204
204
  // ⬇️ Add this before file @end (for react-native 0.74+)
205
205
  - (void)customizeRootView:(RCTRootView *)rootView {
206
+ [super customizeRootView:rootView];
206
207
  [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // ⬅️ initialize the splash screen
207
208
  }
208
209
 
@@ -7,6 +7,7 @@ buildscript {
7
7
  gradlePluginPortal()
8
8
  }
9
9
  dependencies {
10
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "1.8.0")}")
10
11
  classpath("com.android.tools.build:gradle:7.3.1")
11
12
  }
12
13
  }
@@ -16,14 +17,15 @@ def isNewArchitectureEnabled() {
16
17
  }
17
18
 
18
19
  apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
19
21
 
20
22
  if (isNewArchitectureEnabled()) {
21
23
  apply plugin: "com.facebook.react"
22
24
  }
23
25
 
24
26
  android {
25
- buildToolsVersion safeExtGet("buildToolsVersion", "33.0.0")
26
- compileSdkVersion safeExtGet("compileSdkVersion", 33)
27
+ buildToolsVersion safeExtGet("buildToolsVersion", "34.0.0")
28
+ compileSdkVersion safeExtGet("compileSdkVersion", 34)
27
29
 
28
30
  if (project.android.hasProperty("namespace")) {
29
31
  namespace "com.zoontek.rnbootsplash"
@@ -39,8 +41,8 @@ android {
39
41
  }
40
42
  defaultConfig {
41
43
  buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
42
- minSdkVersion safeExtGet("minSdkVersion", 21)
43
- targetSdkVersion safeExtGet("targetSdkVersion", 33)
44
+ minSdkVersion safeExtGet("minSdkVersion", 23)
45
+ targetSdkVersion safeExtGet("targetSdkVersion", 34)
44
46
  }
45
47
  lintOptions {
46
48
  abortOnError false
@@ -0,0 +1,13 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import android.app.Activity
4
+
5
+ import androidx.annotation.StyleRes
6
+
7
+ object RNBootSplash {
8
+
9
+ @JvmStatic
10
+ fun init(activity: Activity, @StyleRes themeResId: Int) {
11
+ RNBootSplashModuleImpl.init(activity, themeResId)
12
+ }
13
+ }
@@ -0,0 +1,79 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import android.app.Activity
4
+ import android.app.Dialog
5
+ import android.os.Bundle
6
+ import android.view.WindowManager
7
+
8
+ import androidx.annotation.StyleRes
9
+
10
+ class RNBootSplashDialog(
11
+ activity: Activity,
12
+ @StyleRes themeResId: Int,
13
+ private val fade: Boolean
14
+ ) : Dialog(activity, themeResId) {
15
+
16
+ init {
17
+ setOwnerActivity(activity)
18
+ setCancelable(false)
19
+ setCanceledOnTouchOutside(false)
20
+ }
21
+
22
+ @Deprecated("Deprecated in favor of OnBackPressedCallback")
23
+ override fun onBackPressed() {
24
+ val activity = ownerActivity
25
+ activity?.moveTaskToBack(true)
26
+ }
27
+
28
+ override fun dismiss() {
29
+ if (isShowing) {
30
+ runCatching { super.dismiss() }
31
+ }
32
+ }
33
+
34
+ fun dismiss(callback: () -> Unit) {
35
+ if (isShowing) {
36
+ setOnDismissListener { callback() }
37
+ runCatching { super.dismiss() }.onFailure { callback() }
38
+ } else {
39
+ callback()
40
+ }
41
+ }
42
+
43
+ override fun show() {
44
+ if (!isShowing) {
45
+ runCatching { super.show() }
46
+ }
47
+ }
48
+
49
+ fun show(callback: () -> Unit) {
50
+ if (!isShowing) {
51
+ setOnShowListener { callback() }
52
+ runCatching { super.show() }.onFailure { callback() }
53
+ } else {
54
+ callback()
55
+ }
56
+ }
57
+
58
+ override fun onCreate(savedInstanceState: Bundle?) {
59
+ window?.apply {
60
+ setLayout(
61
+ WindowManager.LayoutParams.MATCH_PARENT,
62
+ WindowManager.LayoutParams.MATCH_PARENT
63
+ )
64
+
65
+ setWindowAnimations(
66
+ when {
67
+ fade -> R.style.BootSplashFadeOutAnimation
68
+ else -> R.style.BootSplashNoAnimation
69
+ }
70
+ )
71
+
72
+ if (RNBootSplashModuleImpl.isSamsungOneUI4()) {
73
+ setBackgroundDrawableResource(R.drawable.compat_splash_screen_oneui_4)
74
+ }
75
+ }
76
+
77
+ super.onCreate(savedInstanceState)
78
+ }
79
+ }
@@ -0,0 +1,242 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.app.Activity
5
+ import android.content.res.Configuration
6
+ import android.os.Build
7
+ import android.util.TypedValue
8
+ import android.view.View
9
+ import android.view.ViewConfiguration
10
+ import android.view.ViewTreeObserver.OnPreDrawListener
11
+
12
+ import androidx.annotation.StyleRes
13
+
14
+ import com.facebook.common.logging.FLog
15
+ import com.facebook.react.bridge.Promise
16
+ import com.facebook.react.bridge.ReactApplicationContext
17
+ import com.facebook.react.bridge.UiThreadUtil
18
+ import com.facebook.react.common.ReactConstants
19
+ import com.facebook.react.uimanager.PixelUtil
20
+
21
+ import java.util.Timer
22
+ import java.util.TimerTask
23
+
24
+ object RNBootSplashModuleImpl {
25
+ const val NAME = "RNBootSplash"
26
+
27
+ private enum class Status {
28
+ HIDDEN,
29
+ HIDING,
30
+ INITIALIZING,
31
+ VISIBLE,
32
+ }
33
+
34
+ private val mPromiseQueue = RNBootSplashQueue<Promise>()
35
+ private var mStatus = Status.HIDDEN
36
+
37
+ @StyleRes
38
+ private var mThemeResId = -1
39
+
40
+ private var mInitialDialog: RNBootSplashDialog? = null
41
+ private var mFadeOutDialog: RNBootSplashDialog? = null
42
+
43
+ internal fun init(activity: Activity?, @StyleRes themeResId: Int) {
44
+ if (mThemeResId != -1) {
45
+ return FLog.w(
46
+ ReactConstants.TAG,
47
+ "$NAME: Ignored initialization, module is already initialized."
48
+ )
49
+ }
50
+
51
+ mThemeResId = themeResId
52
+
53
+ if (activity == null) {
54
+ return FLog.w(
55
+ ReactConstants.TAG,
56
+ "$NAME: Ignored initialization, current activity is null."
57
+ )
58
+ }
59
+
60
+ // Apply postBootSplashTheme
61
+ val typedValue = TypedValue()
62
+ val currentTheme = activity.theme
63
+
64
+ if (currentTheme.resolveAttribute(R.attr.postBootSplashTheme, typedValue, true)) {
65
+ val finalThemeId = typedValue.resourceId
66
+
67
+ if (finalThemeId != 0) {
68
+ activity.setTheme(finalThemeId)
69
+ }
70
+ }
71
+
72
+ // Keep the splash screen on-screen until Dialog is shown
73
+ val contentView = activity.findViewById<View>(android.R.id.content)
74
+ mStatus = Status.INITIALIZING
75
+
76
+ contentView
77
+ .viewTreeObserver
78
+ .addOnPreDrawListener(object : OnPreDrawListener {
79
+ override fun onPreDraw(): Boolean {
80
+ if (mStatus == Status.INITIALIZING) {
81
+ return false
82
+ }
83
+
84
+ contentView
85
+ .viewTreeObserver
86
+ .removeOnPreDrawListener(this)
87
+
88
+ return true
89
+ }
90
+ })
91
+
92
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
93
+ // This is not called on Android 12 when activity is started using intent
94
+ // (Android studio / CLI / notification / widget…)
95
+ activity
96
+ .splashScreen
97
+ .setOnExitAnimationListener { view ->
98
+ view.remove() // Remove it immediately, without animation
99
+
100
+ activity
101
+ .splashScreen
102
+ .clearOnExitAnimationListener()
103
+ }
104
+ }
105
+
106
+ mInitialDialog = RNBootSplashDialog(activity, mThemeResId, false)
107
+
108
+ UiThreadUtil.runOnUiThread {
109
+ mInitialDialog?.show { mStatus = Status.VISIBLE }
110
+ }
111
+ }
112
+
113
+ private fun clearPromiseQueue() {
114
+ while (!mPromiseQueue.isEmpty()) {
115
+ mPromiseQueue.shift()?.resolve(true)
116
+ }
117
+ }
118
+
119
+ private fun hideAndClearPromiseQueue(reactContext: ReactApplicationContext, fade: Boolean) {
120
+ UiThreadUtil.runOnUiThread {
121
+ val activity = reactContext.currentActivity
122
+
123
+ if (mStatus == Status.INITIALIZING
124
+ || activity == null
125
+ || activity.isFinishing
126
+ || activity.isDestroyed
127
+ ) {
128
+ val timer = Timer()
129
+
130
+ timer.schedule(object : TimerTask() {
131
+ override fun run() {
132
+ timer.cancel()
133
+ hideAndClearPromiseQueue(reactContext, fade)
134
+ }
135
+ }, 100)
136
+
137
+ return@runOnUiThread
138
+ }
139
+
140
+ if (mStatus == Status.HIDING) {
141
+ return@runOnUiThread // wait until fade out end for clearPromiseQueue
142
+ }
143
+
144
+ if (mStatus == Status.HIDDEN) {
145
+ clearPromiseQueue()
146
+ return@runOnUiThread // both initial and fade out dialog are hidden
147
+ }
148
+
149
+ mStatus = Status.HIDING
150
+
151
+ val hideSequence = {
152
+ val fadeOutDialogDismiss = {
153
+ mFadeOutDialog = null
154
+ mStatus = Status.HIDDEN
155
+ clearPromiseQueue()
156
+ }
157
+
158
+ val initialDialogDismiss = {
159
+ mInitialDialog = null
160
+ mFadeOutDialog?.dismiss(fadeOutDialogDismiss) ?: fadeOutDialogDismiss()
161
+ }
162
+
163
+ mInitialDialog?.dismiss(initialDialogDismiss) ?: initialDialogDismiss()
164
+ }
165
+
166
+ if (fade) {
167
+ // Create a new Dialog instance with fade out animation
168
+ mFadeOutDialog = RNBootSplashDialog(activity, mThemeResId, true)
169
+ mFadeOutDialog?.show(hideSequence)
170
+ } else {
171
+ mInitialDialog?.dismiss(hideSequence) ?: hideSequence()
172
+ }
173
+ }
174
+ }
175
+
176
+ // From https://stackoverflow.com/a/61062773
177
+ fun isSamsungOneUI4(): Boolean {
178
+ return runCatching {
179
+ val field = Build.VERSION::class.java.getDeclaredField("SEM_PLATFORM_INT")
180
+ val version = (field.getInt(null) - 90000) / 10000
181
+ version == 4
182
+ }.getOrDefault(false)
183
+ }
184
+
185
+ internal fun onHostDestroy() {
186
+ mStatus = Status.HIDDEN
187
+ mThemeResId = -1
188
+ clearPromiseQueue()
189
+
190
+ mInitialDialog?.apply {
191
+ dismiss()
192
+ mInitialDialog = null
193
+ }
194
+
195
+ mFadeOutDialog?.apply {
196
+ dismiss()
197
+ mFadeOutDialog = null
198
+ }
199
+ }
200
+
201
+ fun getConstants(reactContext: ReactApplicationContext): Map<String, Any> {
202
+ val resources = reactContext.resources
203
+ val constants = HashMap<String, Any>()
204
+
205
+ val uiMode =
206
+ reactContext.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
207
+
208
+ @SuppressLint("InternalInsetResource", "DiscouragedApi") val statusBarHeightResId =
209
+ resources.getIdentifier("status_bar_height", "dimen", "android")
210
+
211
+ @SuppressLint("InternalInsetResource", "DiscouragedApi") val navigationBarHeightResId =
212
+ resources.getIdentifier("navigation_bar_height", "dimen", "android")
213
+
214
+ val statusBarHeight = when {
215
+ statusBarHeightResId > 0 ->
216
+ PixelUtil.toDIPFromPixel(resources.getDimensionPixelSize(statusBarHeightResId).toFloat())
217
+ else -> 0f
218
+ }
219
+
220
+ val navigationBarHeight = when {
221
+ navigationBarHeightResId > 0 && !ViewConfiguration.get(reactContext).hasPermanentMenuKey() ->
222
+ PixelUtil.toDIPFromPixel(resources.getDimensionPixelSize(navigationBarHeightResId).toFloat())
223
+ else -> 0f
224
+ }
225
+
226
+ constants["darkModeEnabled"] = uiMode == Configuration.UI_MODE_NIGHT_YES
227
+ constants["logoSizeRatio"] = if (isSamsungOneUI4()) 0.5 else 1.0
228
+ constants["navigationBarHeight"] = navigationBarHeight
229
+ constants["statusBarHeight"] = statusBarHeight
230
+
231
+ return constants
232
+ }
233
+
234
+ fun hide(reactContext: ReactApplicationContext, fade: Boolean, promise: Promise) {
235
+ mPromiseQueue.push(promise)
236
+ hideAndClearPromiseQueue(reactContext, fade)
237
+ }
238
+
239
+ fun isVisible(promise: Promise) {
240
+ promise.resolve(mStatus != Status.HIDDEN)
241
+ }
242
+ }
@@ -0,0 +1,37 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+
9
+ class RNBootSplashPackage : TurboReactPackage() {
10
+
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return when (name) {
13
+ RNBootSplashModuleImpl.NAME -> RNBootSplashModule(reactContext)
14
+ else -> null
15
+ }
16
+ }
17
+
18
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
19
+ return ReactModuleInfoProvider {
20
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
21
+ val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
22
+
23
+ val moduleInfo = ReactModuleInfo(
24
+ RNBootSplashModuleImpl.NAME,
25
+ RNBootSplashModuleImpl.NAME,
26
+ false,
27
+ false,
28
+ true,
29
+ false,
30
+ isTurboModule
31
+ )
32
+
33
+ moduleInfos[RNBootSplashModuleImpl.NAME] = moduleInfo
34
+ moduleInfos
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,26 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import java.util.Vector
4
+
5
+ /**
6
+ * Represents a first-in-first-out (FIFO) thread safe queue of objects.
7
+ * Its source code is based on Java internal `Stack`.
8
+ */
9
+ class RNBootSplashQueue<E> : Vector<E>() {
10
+
11
+ @Synchronized
12
+ fun shift(): E? {
13
+ if (size == 0) {
14
+ return null
15
+ }
16
+
17
+ val item = elementAt(0)
18
+ removeElementAt(0)
19
+
20
+ return item
21
+ }
22
+
23
+ fun push(item: E) {
24
+ addElement(item)
25
+ }
26
+ }
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/remote_color_resources_res/values/colors.xml;l=67 -->
4
+ <!-- https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/res/color/system_bar_background_semi_transparent.xml -->
5
+ <color name="systemBarDarkScrim">#801b1b1b</color>
6
+ <!-- https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/com/android/internal/policy/DecorView.java;l=142 -->
7
+ <color name="systemBarLightScrim">#e6ffffff</color>
8
+ </resources>
@@ -10,35 +10,35 @@
10
10
  <item name="android:windowExitAnimation">@anim/bootsplash_fade_out</item>
11
11
  </style>
12
12
 
13
- <style name="Theme.BootSplash.Common" parent="Theme.AppCompat.DayNight.NoActionBar">
13
+ <style name="Theme.BootSplash.DayNight" parent="Theme.AppCompat.DayNight.NoActionBar">
14
+ </style>
15
+
16
+ <style name="Theme.BootSplash.Base" parent="Theme.BootSplash.DayNight">
17
+ <item name="darkContentBarsStyle">true</item>
18
+ </style>
19
+
20
+ <style name="Theme.BootSplash.Common" parent="Theme.BootSplash.Base">
14
21
  <item name="android:opacity">opaque</item>
15
22
  <item name="android:windowBackground">@drawable/compat_splash_screen</item>
16
23
  <item name="bootSplashBrand">@drawable/transparent_pixel</item>
17
24
  </style>
18
25
 
19
- <style name="Theme.BootSplash.DayNight" parent="Theme.BootSplash.Common">
20
- </style>
21
-
22
- <style name="Theme.BootSplash" parent="Theme.BootSplash.DayNight">
26
+ <style name="Theme.BootSplash" parent="Theme.BootSplash.Common">
23
27
  <item name="bootSplashBackground">?android:colorBackground</item>
24
28
  <item name="bootSplashLogo">@android:drawable/sym_def_app_icon</item>
25
29
  <item name="postBootSplashTheme">?android:attr/theme</item>
26
30
  </style>
27
31
 
28
- <style name="Theme.BootSplash.BarsStyle" parent="Theme.BootSplash">
29
- <item name="darkContentBarsStyle">true</item>
30
- </style>
31
-
32
- <style name="Theme.BootSplash.TransparentStatus" parent="Theme.BootSplash.BarsStyle">
32
+ <style name="Theme.BootSplash.TransparentStatus" parent="Theme.BootSplash">
33
33
  </style>
34
34
 
35
- <style name="Theme.BootSplash.EdgeToEdge.Common" parent="Theme.BootSplash.BarsStyle">
35
+ <style name="Theme.BootSplash.EdgeToEdge.Common" parent="Theme.BootSplash">
36
36
  <item name="android:fitsSystemWindows">false</item>
37
37
  <item name="android:windowDrawsSystemBarBackgrounds">true</item>
38
38
  </style>
39
39
 
40
40
  <style name="Theme.BootSplash.EdgeToEdge" parent="Theme.BootSplash.EdgeToEdge.Common">
41
- <item name="android:windowTranslucentStatus">true</item>
42
- <item name="android:windowTranslucentNavigation">true</item>
41
+ <item name="android:statusBarColor">@color/systemBarDarkScrim</item>
42
+ <item name="android:navigationBarColor">@color/systemBarDarkScrim</item>
43
43
  </style>
44
44
  </resources>
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <style name="Theme.BootSplash.BarsStyle" parent="Theme.BootSplash">
3
+ <style name="Theme.BootSplash.Base" parent="Theme.BootSplash.DayNight">
4
4
  <item name="darkContentBarsStyle">false</item>
5
5
  </style>
6
6
  </resources>
@@ -1,12 +1,12 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <style name="Theme.BootSplash.TransparentStatus" parent="Theme.BootSplash.BarsStyle">
3
+ <style name="Theme.BootSplash.TransparentStatus" parent="Theme.BootSplash">
4
4
  <item name="android:statusBarColor">@android:color/transparent</item>
5
5
  <item name="android:windowLightStatusBar">?darkContentBarsStyle</item>
6
6
  </style>
7
7
 
8
8
  <style name="Theme.BootSplash.EdgeToEdge" parent="Theme.BootSplash.EdgeToEdge.Common">
9
- <item name="android:windowTranslucentNavigation">true</item>
9
+ <item name="android:navigationBarColor">@color/systemBarDarkScrim</item>
10
10
  <item name="android:statusBarColor">@android:color/transparent</item>
11
11
  <item name="android:windowLightStatusBar">?darkContentBarsStyle</item>
12
12
  </style>
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <style name="Theme.BootSplash.DayNight" parent="Theme.BootSplash.Common">
3
+ <style name="Theme.BootSplash.DayNight" parent="Theme.AppCompat.DayNight.NoActionBar">
4
4
  <item name="android:forceDarkAllowed">false</item>
5
5
  </style>
6
6
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <style name="Theme.BootSplash" parent="Theme.BootSplash.DayNight">
3
+ <style name="Theme.BootSplash" parent="Theme.BootSplash.Common">
4
4
  <item name="android:windowSplashScreenBackground">?bootSplashBackground</item>
5
5
  <item name="android:windowSplashScreenAnimatedIcon">?bootSplashLogo</item>
6
6
  <item name="android:windowSplashScreenBrandingImage">?bootSplashBrand</item>
@@ -0,0 +1,39 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import com.facebook.react.bridge.LifecycleEventListener
4
+ import com.facebook.react.bridge.Promise
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.annotations.ReactModule
7
+
8
+ @ReactModule(name = RNBootSplashModuleImpl.NAME)
9
+ class RNBootSplashModule(reactContext: ReactApplicationContext) :
10
+ NativeRNBootSplashSpec(reactContext), LifecycleEventListener {
11
+
12
+ init {
13
+ reactContext.addLifecycleEventListener(this)
14
+ }
15
+
16
+ override fun getName(): String {
17
+ return RNBootSplashModuleImpl.NAME
18
+ }
19
+
20
+ override fun onHostResume() {}
21
+
22
+ override fun onHostPause() {}
23
+
24
+ override fun onHostDestroy() {
25
+ RNBootSplashModuleImpl.onHostDestroy()
26
+ }
27
+
28
+ override fun getTypedExportedConstants(): Map<String, Any> {
29
+ return RNBootSplashModuleImpl.getConstants(reactApplicationContext)
30
+ }
31
+
32
+ override fun hide(fade: Boolean, promise: Promise) {
33
+ RNBootSplashModuleImpl.hide(reactApplicationContext, fade, promise)
34
+ }
35
+
36
+ override fun isVisible(promise: Promise) {
37
+ RNBootSplashModuleImpl.isVisible(promise)
38
+ }
39
+ }
@@ -0,0 +1,43 @@
1
+ package com.zoontek.rnbootsplash
2
+
3
+ import com.facebook.react.bridge.LifecycleEventListener
4
+ import com.facebook.react.bridge.Promise
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
7
+ import com.facebook.react.bridge.ReactMethod
8
+ import com.facebook.react.module.annotations.ReactModule
9
+
10
+ @ReactModule(name = RNBootSplashModuleImpl.NAME)
11
+ class RNBootSplashModule(reactContext: ReactApplicationContext) :
12
+ ReactContextBaseJavaModule(reactContext), LifecycleEventListener {
13
+
14
+ init {
15
+ reactContext.addLifecycleEventListener(this)
16
+ }
17
+
18
+ override fun getName(): String {
19
+ return RNBootSplashModuleImpl.NAME
20
+ }
21
+
22
+ override fun onHostResume() {}
23
+
24
+ override fun onHostPause() {}
25
+
26
+ override fun onHostDestroy() {
27
+ RNBootSplashModuleImpl.onHostDestroy()
28
+ }
29
+
30
+ override fun getConstants(): Map<String, Any> {
31
+ return RNBootSplashModuleImpl.getConstants(reactApplicationContext)
32
+ }
33
+
34
+ @ReactMethod
35
+ fun hide(fade: Boolean, promise: Promise) {
36
+ RNBootSplashModuleImpl.hide(reactApplicationContext, fade, promise)
37
+ }
38
+
39
+ @ReactMethod
40
+ fun isVisible(promise: Promise) {
41
+ RNBootSplashModuleImpl.isVisible(promise)
42
+ }
43
+ }