expo-splash-screen 0.26.4 → 0.27.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/CHANGELOG.md CHANGED
@@ -10,15 +10,25 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.26.4 — 2024-01-24
13
+ ## 0.27.0 — 2024-04-18
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fixed white screen flickering when using expo-updates with longer `fallbackToCacheTimeout`. ([#28227](https://github.com/expo/expo/pull/28227) by [@kudo](https://github.com/kudo))
18
+
19
+ ### 💡 Others
20
+
21
+ - Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
22
+
23
+ ## 0.26.4 - 2024-01-24
14
24
 
15
25
  _This version does not introduce any user-facing changes._
16
26
 
17
- ## 0.26.3 2024-01-18
27
+ ## 0.26.3 - 2024-01-18
18
28
 
19
29
  _This version does not introduce any user-facing changes._
20
30
 
21
- ## 0.26.2 2024-01-10
31
+ ## 0.26.2 - 2024-01-10
22
32
 
23
33
  ### 🐛 Bug fixes
24
34
 
@@ -28,7 +38,7 @@ _This version does not introduce any user-facing changes._
28
38
 
29
39
  - Replace deprecated `com.facebook.react:react-native:+` Android dependency with `com.facebook.react:react-android`. ([#26237](https://github.com/expo/expo/pull/26237) by [@kudo](https://github.com/kudo))
30
40
 
31
- ## 0.26.1 2023-12-19
41
+ ## 0.26.1 - 2023-12-19
32
42
 
33
43
  _This version does not introduce any user-facing changes._
34
44
 
@@ -1,111 +1,25 @@
1
1
  apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'maven-publish'
4
2
 
5
3
  group = 'host.exp.exponent'
6
- version = '0.26.4'
4
+ version = '0.27.0'
7
5
 
8
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
- if (expoModulesCorePlugin.exists()) {
10
- apply from: expoModulesCorePlugin
11
- applyKotlinExpoModulesCorePlugin()
12
- // Remove this check, but keep the contents after SDK49 support is dropped
13
- if (safeExtGet("expoProvidesDefaultConfig", false)) {
14
- useExpoPublishing()
15
- useCoreDependencies()
16
- }
17
- }
18
-
19
- buildscript {
20
- // Simple helper that allows the root project to override versions declared by this library.
21
- ext.safeExtGet = { prop, fallback ->
22
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
- }
24
-
25
- // Ensures backward compatibility
26
- ext.getKotlinVersion = {
27
- if (ext.has("kotlinVersion")) {
28
- ext.kotlinVersion()
29
- } else {
30
- ext.safeExtGet("kotlinVersion", "1.8.10")
31
- }
32
- }
33
-
34
- repositories {
35
- mavenCentral()
36
- }
37
-
38
- dependencies {
39
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
40
- }
41
- }
42
-
43
- // Remove this if and it's contents, when support for SDK49 is dropped
44
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
45
- afterEvaluate {
46
- publishing {
47
- publications {
48
- release(MavenPublication) {
49
- from components.release
50
- }
51
- }
52
- repositories {
53
- maven {
54
- url = mavenLocal().url
55
- }
56
- }
57
- }
58
- }
59
- }
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useDefaultAndroidSdkVersions()
11
+ useExpoPublishing()
60
12
 
61
13
  android {
62
- // Remove this if and it's contents, when support for SDK49 is dropped
63
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
64
- compileSdkVersion safeExtGet("compileSdkVersion", 34)
65
-
66
- defaultConfig {
67
- minSdkVersion safeExtGet("minSdkVersion", 23)
68
- targetSdkVersion safeExtGet("targetSdkVersion", 34)
69
- }
70
-
71
- publishing {
72
- singleVariant("release") {
73
- withSourcesJar()
74
- }
75
- }
76
-
77
- lintOptions {
78
- abortOnError false
79
- }
80
- }
81
-
82
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
83
- if (agpVersion.tokenize('.')[0].toInteger() < 8) {
84
- compileOptions {
85
- sourceCompatibility JavaVersion.VERSION_11
86
- targetCompatibility JavaVersion.VERSION_11
87
- }
88
-
89
- kotlinOptions {
90
- jvmTarget = JavaVersion.VERSION_11.majorVersion
91
- }
92
- }
93
-
94
14
  namespace "expo.modules.splashscreen"
95
15
  defaultConfig {
96
16
  versionCode 17
97
- versionName '0.26.4'
17
+ versionName '0.27.0'
98
18
  }
99
19
  }
100
20
 
101
21
  dependencies {
102
- // Remove this if and it's contents, when support for SDK49 is dropped
103
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
104
- implementation project(':expo-modules-core')
105
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
106
- }
107
-
108
22
  implementation 'com.facebook.react:react-android'
109
23
  implementation 'androidx.appcompat:appcompat:1.2.0'
110
- implementation "org.jetbrains.kotlin:kotlin-reflect:${getKotlinVersion()}"
24
+ implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion()}"
111
25
  }
@@ -5,9 +5,6 @@ package expo.modules.splashscreen
5
5
  import android.content.Context
6
6
  import androidx.core.content.ContextCompat
7
7
 
8
- // this needs to stay for versioning to work
9
- // EXPO_VERSIONING_NEEDS_PACKAGE_R
10
-
11
8
  /**
12
9
  * Default implementation that uses native resources.
13
10
  */
@@ -1,10 +1,11 @@
1
1
  package expo.modules.splashscreen
2
2
 
3
3
  import android.content.Context
4
- import expo.modules.splashscreen.singletons.SplashScreen
5
4
  import expo.modules.core.interfaces.Package
5
+ import expo.modules.core.interfaces.ReactActivityHandler
6
6
  import expo.modules.core.interfaces.ReactActivityLifecycleListener
7
7
  import expo.modules.core.interfaces.SingletonModule
8
+ import expo.modules.splashscreen.singletons.SplashScreen
8
9
 
9
10
  class SplashScreenPackage : Package {
10
11
  override fun createSingletonModules(context: Context?): List<SingletonModule> {
@@ -14,4 +15,8 @@ class SplashScreenPackage : Package {
14
15
  override fun createReactActivityLifecycleListeners(activityContext: Context): List<ReactActivityLifecycleListener> {
15
16
  return listOf(SplashScreenReactActivityLifecycleListener(activityContext))
16
17
  }
18
+
19
+ override fun createReactActivityHandlers(activityContext: Context?): List<ReactActivityHandler> {
20
+ return listOf(SplashScreenReactActivityHandler())
21
+ }
17
22
  }
@@ -1,32 +1,45 @@
1
- @file:Suppress("UnusedImport")
2
-
3
1
  package expo.modules.splashscreen
4
2
 
5
3
  import android.app.Activity
6
4
  import android.content.Context
5
+ import com.facebook.react.ReactActivity
6
+ import com.facebook.react.ReactNativeHost
7
7
  import com.facebook.react.ReactRootView
8
+ import expo.modules.core.interfaces.ReactActivityHandler
8
9
  import expo.modules.core.interfaces.ReactActivityLifecycleListener
9
10
  import expo.modules.splashscreen.singletons.SplashScreen
10
11
 
11
- // this needs to stay for versioning to work
12
- // EXPO_VERSIONING_NEEDS_PACKAGE_R
13
-
14
12
  class SplashScreenReactActivityLifecycleListener(activityContext: Context) : ReactActivityLifecycleListener {
15
13
  override fun onContentChanged(activity: Activity) {
16
- SplashScreen.show(
14
+ SplashScreen.ensureShown(
17
15
  activity,
18
16
  getResizeMode(activity),
19
17
  ReactRootView::class.java,
20
18
  getStatusBarTranslucent(activity)
21
19
  )
22
20
  }
21
+ }
23
22
 
24
- private fun getResizeMode(context: Context): SplashScreenImageResizeMode =
25
- SplashScreenImageResizeMode.fromString(
26
- context.getString(R.string.expo_splash_screen_resize_mode).lowercase()
23
+ class SplashScreenReactActivityHandler : ReactActivityHandler {
24
+ override fun getDelayLoadAppHandler(
25
+ activity: ReactActivity,
26
+ reactNativeHost: ReactNativeHost
27
+ ): ReactActivityHandler.DelayLoadAppHandler? {
28
+ SplashScreen.ensureShown(
29
+ activity,
30
+ getResizeMode(activity),
31
+ ReactRootView::class.java,
32
+ getStatusBarTranslucent(activity)
27
33
  )
28
- ?: SplashScreenImageResizeMode.CONTAIN
29
-
30
- private fun getStatusBarTranslucent(context: Context): Boolean =
31
- context.getString(R.string.expo_splash_screen_status_bar_translucent).toBoolean()
34
+ return null
35
+ }
32
36
  }
37
+
38
+ private fun getResizeMode(context: Context): SplashScreenImageResizeMode =
39
+ SplashScreenImageResizeMode.fromString(
40
+ context.getString(R.string.expo_splash_screen_resize_mode).lowercase()
41
+ )
42
+ ?: SplashScreenImageResizeMode.CONTAIN
43
+
44
+ private fun getStatusBarTranslucent(context: Context): Boolean =
45
+ context.getString(R.string.expo_splash_screen_status_bar_translucent).toBoolean()
@@ -149,4 +149,21 @@ object SplashScreen : SingletonModule {
149
149
  fun hide(activity: Activity) {
150
150
  hide(activity, {}, {})
151
151
  }
152
+
153
+ /**
154
+ * An internal helper to make sure splash screen is shown when startup.
155
+ */
156
+ internal fun ensureShown(
157
+ activity: Activity,
158
+ resizeMode: SplashScreenImageResizeMode,
159
+ rootViewClass: Class<out ViewGroup>,
160
+ statusBarTranslucent: Boolean
161
+ ) {
162
+ val controller = controllers[activity]
163
+ if (controller == null) {
164
+ show(activity, resizeMode, rootViewClass, statusBarTranslucent)
165
+ } else {
166
+ controller.showSplashScreen { }
167
+ }
168
+ }
152
169
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,YAAY,GAAG,mBAAmB,CAAC,kBAAkB,CAG1D,CAAC;AAEF,IAAI,8BAA8B,GAAG,KAAK,CAAC;AAC3C,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B;IAClD,4CAA4C;IAC5C,IAAI,4BAA4B,EAAE;QAChC,OAAO,KAAK,CAAC;KACd;IACD,4BAA4B,GAAG,IAAI,CAAC;IAEpC,oGAAoG;IACpG,oEAAoE;IACpE,IAAI,UAAU,EAAE,gBAAgB,EAAE;QAChC,MAAM,eAAe,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACtD,UAAU,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC7C,SAAS,EAAE,CAAC;YACZ,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,YAAY,CAAC,oBAAoB,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,kFAAkF;IAClF,kFAAkF;IAClF,IAAI,8BAA8B,EAAE;QAClC,OAAO;KACR;IACD,SAAS,EAAE,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,UAAU,SAAS;IACvB,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;QACnD,oCAAoC;QACpC;QACE,yDAAyD;QACzD,4BAA4B;YAC5B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,EACjE;YACA,OAAO;SACR;QACD,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,gEAAgE;IAChE,8BAA8B,GAAG,IAAI,CAAC;IACtC,sBAAsB;IACtB,OAAO,8BAA8B,EAAE,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nconst SplashModule = requireNativeModule('ExpoSplashScreen') as {\n preventAutoHideAsync: () => Promise<boolean>;\n hideAsync: () => Promise<boolean>;\n};\n\nlet _userControlledAutoHideEnabled = false;\nlet _preventAutoHideAsyncInvoked = false;\n\n/**\n * Expo Router uses this internal method to ensure that we can detect if the user\n * has explicitly opted into preventing the splash screen from hiding. This means\n * they will also explicitly hide it. If they don't, we will hide it for them after\n * the navigation render completes.\n *\n * @private\n */\nexport async function _internal_preventAutoHideAsync(): Promise<boolean> {\n // Memoize, this should only be called once.\n if (_preventAutoHideAsyncInvoked) {\n return false;\n }\n _preventAutoHideAsyncInvoked = true;\n\n // Append error handling to ensure any uncaught exceptions result in the splash screen being hidden.\n // This prevents the splash screen from floating over error screens.\n if (ErrorUtils?.getGlobalHandler) {\n const originalHandler = ErrorUtils.getGlobalHandler();\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n hideAsync();\n originalHandler(error, isFatal);\n });\n }\n\n return SplashModule.preventAutoHideAsync();\n}\n\n/**\n * Used for Expo libraries to attempt hiding the splash screen after they've completed their work.\n * If the user has explicitly opted into preventing the splash screen from hiding, we should not\n * hide it for them. This is often used for animated splash screens.\n *\n * @private\n */\nexport const _internal_maybeHideAsync = () => {\n // If the user has explicitly opted into preventing the splash screen from hiding,\n // we should not hide it for them. This is often used for animated splash screens.\n if (_userControlledAutoHideEnabled) {\n return;\n }\n hideAsync();\n};\n\nexport function hideAsync() {\n return SplashModule.hideAsync().catch((error: any) => {\n // Hide this very unfortunate error.\n if (\n // Only throw the error is something unexpected happened.\n _preventAutoHideAsyncInvoked &&\n error.message.includes('No native splash screen registered for ')\n ) {\n return;\n }\n throw error;\n });\n}\n\nexport const preventAutoHideAsync = () => {\n // Indicate that the user is controlling the auto hide behavior.\n _userControlledAutoHideEnabled = true;\n // Prevent as usual...\n return _internal_preventAutoHideAsync();\n};\n"]}
1
+ {"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,YAAY,GAAG,mBAAmB,CAAC,kBAAkB,CAG1D,CAAC;AAEF,IAAI,8BAA8B,GAAG,KAAK,CAAC;AAC3C,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B;IAClD,4CAA4C;IAC5C,IAAI,4BAA4B,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,4BAA4B,GAAG,IAAI,CAAC;IAEpC,oGAAoG;IACpG,oEAAoE;IACpE,IAAI,UAAU,EAAE,gBAAgB,EAAE,CAAC;QACjC,MAAM,eAAe,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACtD,UAAU,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC7C,SAAS,EAAE,CAAC;YACZ,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,YAAY,CAAC,oBAAoB,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,kFAAkF;IAClF,kFAAkF;IAClF,IAAI,8BAA8B,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IACD,SAAS,EAAE,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,UAAU,SAAS;IACvB,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;QACnD,oCAAoC;QACpC;QACE,yDAAyD;QACzD,4BAA4B;YAC5B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,EACjE,CAAC;YACD,OAAO;QACT,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,gEAAgE;IAChE,8BAA8B,GAAG,IAAI,CAAC;IACtC,sBAAsB;IACtB,OAAO,8BAA8B,EAAE,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nconst SplashModule = requireNativeModule('ExpoSplashScreen') as {\n preventAutoHideAsync: () => Promise<boolean>;\n hideAsync: () => Promise<boolean>;\n};\n\nlet _userControlledAutoHideEnabled = false;\nlet _preventAutoHideAsyncInvoked = false;\n\n/**\n * Expo Router uses this internal method to ensure that we can detect if the user\n * has explicitly opted into preventing the splash screen from hiding. This means\n * they will also explicitly hide it. If they don't, we will hide it for them after\n * the navigation render completes.\n *\n * @private\n */\nexport async function _internal_preventAutoHideAsync(): Promise<boolean> {\n // Memoize, this should only be called once.\n if (_preventAutoHideAsyncInvoked) {\n return false;\n }\n _preventAutoHideAsyncInvoked = true;\n\n // Append error handling to ensure any uncaught exceptions result in the splash screen being hidden.\n // This prevents the splash screen from floating over error screens.\n if (ErrorUtils?.getGlobalHandler) {\n const originalHandler = ErrorUtils.getGlobalHandler();\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n hideAsync();\n originalHandler(error, isFatal);\n });\n }\n\n return SplashModule.preventAutoHideAsync();\n}\n\n/**\n * Used for Expo libraries to attempt hiding the splash screen after they've completed their work.\n * If the user has explicitly opted into preventing the splash screen from hiding, we should not\n * hide it for them. This is often used for animated splash screens.\n *\n * @private\n */\nexport const _internal_maybeHideAsync = () => {\n // If the user has explicitly opted into preventing the splash screen from hiding,\n // we should not hide it for them. This is often used for animated splash screens.\n if (_userControlledAutoHideEnabled) {\n return;\n }\n hideAsync();\n};\n\nexport function hideAsync() {\n return SplashModule.hideAsync().catch((error: any) => {\n // Hide this very unfortunate error.\n if (\n // Only throw the error is something unexpected happened.\n _preventAutoHideAsyncInvoked &&\n error.message.includes('No native splash screen registered for ')\n ) {\n return;\n }\n throw error;\n });\n}\n\nexport const preventAutoHideAsync = () => {\n // Indicate that the user is controlling the auto hide behavior.\n _userControlledAutoHideEnabled = true;\n // Prevent as usual...\n return _internal_preventAutoHideAsync();\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-splash-screen",
3
- "version": "0.26.4",
3
+ "version": "0.27.0",
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,7 +34,7 @@
34
34
  "license": "MIT",
35
35
  "homepage": "https://docs.expo.dev/versions/latest/sdk/splash-screen/",
36
36
  "dependencies": {
37
- "@expo/prebuild-config": "6.7.4"
37
+ "@expo/prebuild-config": "7.0.0-beta.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "expo-module-scripts": "^3.0.0"
@@ -42,5 +42,5 @@
42
42
  "peerDependencies": {
43
43
  "expo": "*"
44
44
  },
45
- "gitHead": "dd467f9665171a9729dad8837ea595cd046936f4"
45
+ "gitHead": "4165b8d72e1b9a1889c2767534cc619e21468110"
46
46
  }