expo-splash-screen 0.24.0 → 0.25.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,6 +10,21 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.25.0 — 2023-11-14
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
18
+ - On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
19
+
20
+ ### 🎉 New features
21
+
22
+ - Automatically dismiss splash screen when an error is thrown to prevent blocking error information. ([#24893](https://github.com/expo/expo/pull/24893) by [@EvanBacon](https://github.com/EvanBacon))
23
+
24
+ ### 💡 Others
25
+
26
+ - Moved changes required for splash screen orchestration from `expo-router` to `expo-splash-screen`. ([#24893](https://github.com/expo/expo/pull/24893) by [@EvanBacon](https://github.com/EvanBacon))
27
+
13
28
  ## 0.24.0 — 2023-10-17
14
29
 
15
30
  ### 🛠 Breaking changes
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.24.0'
6
+ version = '0.25.0'
7
7
 
8
8
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
9
  if (expoModulesCorePlugin.exists()) {
@@ -61,11 +61,11 @@ if (!safeExtGet("expoProvidesDefaultConfig", false)) {
61
61
  android {
62
62
  // Remove this if and it's contents, when support for SDK49 is dropped
63
63
  if (!safeExtGet("expoProvidesDefaultConfig", false)) {
64
- compileSdkVersion safeExtGet("compileSdkVersion", 33)
64
+ compileSdkVersion safeExtGet("compileSdkVersion", 34)
65
65
 
66
66
  defaultConfig {
67
67
  minSdkVersion safeExtGet("minSdkVersion", 23)
68
- targetSdkVersion safeExtGet("targetSdkVersion", 33)
68
+ targetSdkVersion safeExtGet("targetSdkVersion", 34)
69
69
  }
70
70
 
71
71
  publishing {
@@ -93,10 +93,8 @@ android {
93
93
 
94
94
  namespace "expo.modules.splashscreen"
95
95
  defaultConfig {
96
- minSdkVersion safeExtGet('minSdkVersion', 21)
97
- targetSdkVersion safeExtGet("targetSdkVersion", 33)
98
96
  versionCode 17
99
- versionName '0.24.0'
97
+ versionName '0.25.0'
100
98
  }
101
99
  }
102
100
 
@@ -1,2 +1,20 @@
1
- export declare const preventAutoHideAsync: () => Promise<boolean>, hideAsync: () => Promise<boolean>;
1
+ /**
2
+ * Expo Router uses this internal method to ensure that we can detect if the user
3
+ * has explicitly opted into preventing the splash screen from hiding. This means
4
+ * they will also explicitly hide it. If they don't, we will hide it for them after
5
+ * the navigation render completes.
6
+ *
7
+ * @private
8
+ */
9
+ export declare const _internal_preventAutoHideAsync: () => void;
10
+ /**
11
+ * Used for Expo libraries to attempt hiding the splash screen after they've completed their work.
12
+ * If the user has explicitly opted into preventing the splash screen from hiding, we should not
13
+ * hide it for them. This is often used for animated splash screens.
14
+ *
15
+ * @private
16
+ */
17
+ export declare const _internal_maybeHideAsync: () => void;
18
+ export declare function hideAsync(): Promise<boolean | void>;
19
+ export declare const preventAutoHideAsync: () => void;
2
20
  //# sourceMappingURL=index.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAEA,eAAO,MAAQ,oBAAoB,QACL,QAAQ,OAAO,CAAC,EADT,SAAS,QAE3B,QAAQ,OAAO,CACjC,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,YAkB1C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,YAOpC,CAAC;AAEF,wBAAgB,SAAS,4BAYxB;AAED,eAAO,MAAM,oBAAoB,YAKhC,CAAC"}
@@ -1,3 +1,63 @@
1
1
  import { requireNativeModule } from 'expo-modules-core';
2
- export const { preventAutoHideAsync, hideAsync } = requireNativeModule('ExpoSplashScreen');
2
+ const SplashModule = requireNativeModule('ExpoSplashScreen');
3
+ let _userControlledAutoHideEnabled = false;
4
+ let _preventAutoHideAsyncInvoked = false;
5
+ /**
6
+ * Expo Router uses this internal method to ensure that we can detect if the user
7
+ * has explicitly opted into preventing the splash screen from hiding. This means
8
+ * they will also explicitly hide it. If they don't, we will hide it for them after
9
+ * the navigation render completes.
10
+ *
11
+ * @private
12
+ */
13
+ export const _internal_preventAutoHideAsync = () => {
14
+ // Memoize, this should only be called once.
15
+ if (_preventAutoHideAsyncInvoked) {
16
+ return;
17
+ }
18
+ _preventAutoHideAsyncInvoked = true;
19
+ // Append error handling to ensure any uncaught exceptions result in the splash screen being hidden.
20
+ // This prevents the splash screen from floating over error screens.
21
+ if (ErrorUtils?.getGlobalHandler) {
22
+ const originalHandler = ErrorUtils.getGlobalHandler();
23
+ ErrorUtils.setGlobalHandler((error, isFatal) => {
24
+ hideAsync();
25
+ originalHandler(error, isFatal);
26
+ });
27
+ }
28
+ SplashModule.preventAutoHideAsync();
29
+ };
30
+ /**
31
+ * Used for Expo libraries to attempt hiding the splash screen after they've completed their work.
32
+ * If the user has explicitly opted into preventing the splash screen from hiding, we should not
33
+ * hide it for them. This is often used for animated splash screens.
34
+ *
35
+ * @private
36
+ */
37
+ export const _internal_maybeHideAsync = () => {
38
+ // If the user has explicitly opted into preventing the splash screen from hiding,
39
+ // we should not hide it for them. This is often used for animated splash screens.
40
+ if (_userControlledAutoHideEnabled) {
41
+ return;
42
+ }
43
+ hideAsync();
44
+ };
45
+ export function hideAsync() {
46
+ return SplashModule.hideAsync().catch((error) => {
47
+ // Hide this very unfortunate error.
48
+ if (
49
+ // Only throw the error is something unexpected happened.
50
+ _preventAutoHideAsyncInvoked &&
51
+ error.message.includes('No native splash screen registered for ')) {
52
+ return;
53
+ }
54
+ throw error;
55
+ });
56
+ }
57
+ export const preventAutoHideAsync = () => {
58
+ // Indicate that the user is controlling the auto hide behavior.
59
+ _userControlledAutoHideEnabled = true;
60
+ // Prevent as usual...
61
+ _internal_preventAutoHideAsync();
62
+ };
3
63
  //# sourceMappingURL=index.native.js.map
@@ -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,CAAC,MAAM,EAAE,oBAAoB,EAAE,SAAS,EAAE,GAAG,mBAAmB,CAAC,kBAAkB,CAGxF,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nexport const { preventAutoHideAsync, hideAsync } = requireNativeModule('ExpoSplashScreen') as {\n preventAutoHideAsync: () => Promise<boolean>;\n hideAsync: () => Promise<boolean>;\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,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,4CAA4C;IAC5C,IAAI,4BAA4B,EAAE;QAChC,OAAO;KACR;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,YAAY,CAAC,oBAAoB,EAAE,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;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,8BAA8B,EAAE,CAAC;AACnC,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 const _internal_preventAutoHideAsync = () => {\n // Memoize, this should only be called once.\n if (_preventAutoHideAsyncInvoked) {\n return;\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 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 _internal_preventAutoHideAsync();\n};\n"]}
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platforms = { :ios => '13.0', :tvos => '13.0' }
13
+ s.platforms = { :ios => '13.4', :tvos => '13.4' }
14
14
  s.source = { git: 'https://github.com/expo/expo.git' }
15
15
  s.static_framework = true
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-splash-screen",
3
- "version": "0.24.0",
3
+ "version": "0.25.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.5.0"
37
+ "@expo/prebuild-config": "6.6.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": "da25937e2a99661cbe5eb60ca1d8d6245fc96a50"
45
+ "gitHead": "3142a086578deffd8704a8f1b6f0f661527d836c"
46
46
  }
@@ -1,6 +1,74 @@
1
1
  import { requireNativeModule } from 'expo-modules-core';
2
2
 
3
- export const { preventAutoHideAsync, hideAsync } = requireNativeModule('ExpoSplashScreen') as {
3
+ const SplashModule = requireNativeModule('ExpoSplashScreen') as {
4
4
  preventAutoHideAsync: () => Promise<boolean>;
5
5
  hideAsync: () => Promise<boolean>;
6
6
  };
7
+
8
+ let _userControlledAutoHideEnabled = false;
9
+ let _preventAutoHideAsyncInvoked = false;
10
+
11
+ /**
12
+ * Expo Router uses this internal method to ensure that we can detect if the user
13
+ * has explicitly opted into preventing the splash screen from hiding. This means
14
+ * they will also explicitly hide it. If they don't, we will hide it for them after
15
+ * the navigation render completes.
16
+ *
17
+ * @private
18
+ */
19
+ export const _internal_preventAutoHideAsync = () => {
20
+ // Memoize, this should only be called once.
21
+ if (_preventAutoHideAsyncInvoked) {
22
+ return;
23
+ }
24
+ _preventAutoHideAsyncInvoked = true;
25
+
26
+ // Append error handling to ensure any uncaught exceptions result in the splash screen being hidden.
27
+ // This prevents the splash screen from floating over error screens.
28
+ if (ErrorUtils?.getGlobalHandler) {
29
+ const originalHandler = ErrorUtils.getGlobalHandler();
30
+ ErrorUtils.setGlobalHandler((error, isFatal) => {
31
+ hideAsync();
32
+ originalHandler(error, isFatal);
33
+ });
34
+ }
35
+
36
+ SplashModule.preventAutoHideAsync();
37
+ };
38
+
39
+ /**
40
+ * Used for Expo libraries to attempt hiding the splash screen after they've completed their work.
41
+ * If the user has explicitly opted into preventing the splash screen from hiding, we should not
42
+ * hide it for them. This is often used for animated splash screens.
43
+ *
44
+ * @private
45
+ */
46
+ export const _internal_maybeHideAsync = () => {
47
+ // If the user has explicitly opted into preventing the splash screen from hiding,
48
+ // we should not hide it for them. This is often used for animated splash screens.
49
+ if (_userControlledAutoHideEnabled) {
50
+ return;
51
+ }
52
+ hideAsync();
53
+ };
54
+
55
+ export function hideAsync() {
56
+ return SplashModule.hideAsync().catch((error: any) => {
57
+ // Hide this very unfortunate error.
58
+ if (
59
+ // Only throw the error is something unexpected happened.
60
+ _preventAutoHideAsyncInvoked &&
61
+ error.message.includes('No native splash screen registered for ')
62
+ ) {
63
+ return;
64
+ }
65
+ throw error;
66
+ });
67
+ }
68
+
69
+ export const preventAutoHideAsync = () => {
70
+ // Indicate that the user is controlling the auto hide behavior.
71
+ _userControlledAutoHideEnabled = true;
72
+ // Prevent as usual...
73
+ _internal_preventAutoHideAsync();
74
+ };