expo-splash-screen 0.29.18 → 0.29.20

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/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.29.20 — 2025-01-10
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 0.29.19 — 2025-01-08
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - On `iOS`, show the splashscreen again when the app is reloaded. ([#33793](https://github.com/expo/expo/pull/33793) by [@alanjhughes](https://github.com/alanjhughes))
22
+
13
23
  ## 0.29.18 — 2024-12-10
14
24
 
15
25
  _This version does not introduce any user-facing changes._
@@ -1,7 +1,7 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
3
  group = 'host.exp.exponent'
4
- version = '0.29.18'
4
+ version = '0.29.20'
5
5
 
6
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
7
  apply from: expoModulesCorePlugin
@@ -14,7 +14,7 @@ android {
14
14
  namespace "expo.modules.splashscreen"
15
15
  defaultConfig {
16
16
  versionCode 17
17
- versionName '0.29.18'
17
+ versionName '0.29.20'
18
18
  }
19
19
  }
20
20
 
@@ -20,12 +20,13 @@ class SplashScreenModule : Module() {
20
20
  override fun definition() = ModuleDefinition {
21
21
  Name("ExpoSplashScreen")
22
22
 
23
- AsyncFunction<Unit>("preventAutoHideAsync") {
23
+ AsyncFunction<Boolean>("preventAutoHideAsync") {
24
24
  // The user has manually invoked prevent autohide, this is used to allow libraries
25
25
  // such as expo-router to know whether it's safe to hide or if they should wait for
26
26
  // the user to do it.
27
27
  userControlledAutoHideEnabled = true
28
28
  SplashScreenManager.preventAutoHideCalled = true
29
+ return@AsyncFunction true
29
30
  }
30
31
 
31
32
  AsyncFunction<Unit>("internalPreventAutoHideAsync") {
@@ -2,7 +2,7 @@ import React
2
2
  import UIKit
3
3
  import ExpoModulesCore
4
4
 
5
- public class SplashScreenManager: NSObject {
5
+ public class SplashScreenManager: NSObject, RCTReloadListener {
6
6
  @objc public static let shared = SplashScreenManager()
7
7
  private var loadingView: UIView?
8
8
  private var rootView: UIView?
@@ -17,27 +17,7 @@ public class SplashScreenManager: NSObject {
17
17
  }
18
18
 
19
19
  self.rootView = rootView
20
- if let vc = UIStoryboard(name: "SplashScreen", bundle: nil).instantiateInitialViewController() {
21
- loadingView = vc.view
22
- loadingView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
23
-
24
- if let bounds = self.rootView?.bounds {
25
- loadingView?.frame = bounds
26
- loadingView?.center = CGPoint(x: bounds.midX, y: bounds.midY)
27
- }
28
- loadingView?.isHidden = false
29
- #if RCT_NEW_ARCH_ENABLED
30
- if let hostView = rootView as? RCTSurfaceHostingProxyRootView, let loadingView {
31
- hostView.disableActivityIndicatorAutoHide(true)
32
- hostView.loadingView = loadingView
33
- }
34
- #else
35
- if let loadingView {
36
- self.rootView?.addSubview(loadingView)
37
- }
38
- #endif
39
- }
40
-
20
+ showSplashScreen()
41
21
  NotificationCenter.default.addObserver(self, selector: #selector(onAppReady), name: Notification.Name("RCTContentDidAppearNotification"), object: nil)
42
22
  }
43
23
 
@@ -76,6 +56,33 @@ public class SplashScreenManager: NSObject {
76
56
  self.options = options
77
57
  }
78
58
 
59
+ private func showSplashScreen() {
60
+ if let vc = UIStoryboard(name: "SplashScreen", bundle: nil).instantiateInitialViewController() {
61
+ loadingView = vc.view
62
+ loadingView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
63
+
64
+ if let bounds = self.rootView?.bounds {
65
+ loadingView?.frame = bounds
66
+ loadingView?.center = CGPoint(x: bounds.midX, y: bounds.midY)
67
+ }
68
+ loadingView?.isHidden = false
69
+ #if RCT_NEW_ARCH_ENABLED
70
+ if let hostView = rootView as? RCTSurfaceHostingProxyRootView, let loadingView {
71
+ hostView.disableActivityIndicatorAutoHide(true)
72
+ hostView.loadingView = loadingView
73
+ }
74
+ #else
75
+ if let loadingView {
76
+ self.rootView?.addSubview(loadingView)
77
+ }
78
+ #endif
79
+ }
80
+ }
81
+
82
+ public func didReceiveReloadCommand() {
83
+ showSplashScreen()
84
+ }
85
+
79
86
  private func isLoadingViewVisible() -> Bool {
80
87
  guard let loadingView else {
81
88
  return false
@@ -86,6 +93,5 @@ public class SplashScreenManager: NSObject {
86
93
 
87
94
  func removeObservers() {
88
95
  NotificationCenter.default.removeObserver(self, name: Notification.Name("RCTContentDidAppearNotification"), object: nil)
89
- NotificationCenter.default.removeObserver(self, name: Notification.Name.RCTJavaScriptDidLoad, object: nil)
90
96
  }
91
97
  }
@@ -30,6 +30,7 @@ public class SplashScreenModule: Module {
30
30
  // the user to do it.
31
31
  userControlledAutoHideEnabled = true
32
32
  SplashScreenManager.shared.preventAutoHideCalled = true
33
+ return true
33
34
  }
34
35
 
35
36
  AsyncFunction("internalPreventAutoHideAsync") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-splash-screen",
3
- "version": "0.29.18",
3
+ "version": "0.29.20",
4
4
  "description": "Provides a module to allow keeping the native Splash Screen visible until you choose to hide it.",
5
5
  "main": "build",
6
6
  "types": "build",
@@ -34,13 +34,13 @@
34
34
  "license": "MIT",
35
35
  "homepage": "https://docs.expo.dev/versions/latest/sdk/splash-screen/",
36
36
  "dependencies": {
37
- "@expo/prebuild-config": "^8.0.23"
37
+ "@expo/prebuild-config": "^8.0.25"
38
38
  },
39
39
  "devDependencies": {
40
- "expo-module-scripts": "^4.0.0"
40
+ "expo-module-scripts": "^4.0.3"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "expo": "*"
44
44
  },
45
- "gitHead": "02366411c0bb2cb0055d7f4c0813bdaed1fa9bf8"
45
+ "gitHead": "986a4689b91f3efc527f7178a320b987c0005842"
46
46
  }