expo-splash-screen 0.18.2 → 0.20.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,27 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.20.0 — 2023-06-21
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Deprecated `@expo/configure-splash-screen` in favor of the splash screen config plugin. ([#21464](https://github.com/expo/expo/pull/21464) by [@byCedric](https://github.com/byCedric))
18
+
19
+ ### 🎉 New features
20
+
21
+ - Added support for React Native 0.72. ([#22588](https://github.com/expo/expo/pull/22588) by [@kudo](https://github.com/kudo))
22
+ - Migrated Android codebase to use Expo modules API. ([#22827](https://github.com/expo/expo/pull/22827) by [@alanjhughes](https://github.com/alanjhughes))
23
+
24
+ ### 🐛 Bug fixes
25
+
26
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
27
+
28
+ ## 0.19.0 — 2023-05-08
29
+
30
+ ### 💡 Others
31
+
32
+ - Android: Switch from deprecated `toLowerCase` to `lowercase` function ([#22225](https://github.com/expo/expo/pull/22225) by [@hbiede](https://github.com/hbiede))
33
+
13
34
  ## 0.18.2 — 2023-04-26
14
35
 
15
36
  _This version does not introduce any user-facing changes._
package/README.md CHANGED
@@ -1,4 +1,11 @@
1
- # expo-splash-screen
1
+ <p>
2
+ <a href="https://docs.expo.dev/versions/latest/sdk/splash-screen/">
3
+ <img
4
+ src="../../.github/resources/expo-splash-screen.svg"
5
+ alt="expo-splash-screen"
6
+ height="64" />
7
+ </a>
8
+ </p>
2
9
 
3
10
  `expo-splash-screen` allows you to customize your app's splash screen, which is the initial screen users see when the app is launched, before it has loaded. Splash screens (sometimes called launch screens) provide a user's first experience with your application.
4
11
 
@@ -31,10 +38,12 @@ Scale the image uniformly (maintaining the image's aspect ratio) so that both di
31
38
  <td>
32
39
 
33
40
  https://user-images.githubusercontent.com/379606/120575867-aeeb3580-c3d6-11eb-825d-19a847fe30f5.mp4
41
+
34
42
  </td>
35
43
  <td>
36
44
 
37
45
  https://user-images.githubusercontent.com/379606/120575885-b6124380-c3d6-11eb-8485-75a11832962c.mp4
46
+
38
47
  </td>
39
48
  </tr>
40
49
  </tbody>
@@ -50,10 +59,12 @@ Scale the image uniformly (maintaining the image's aspect ratio) so that both th
50
59
  <td>
51
60
 
52
61
  https://user-images.githubusercontent.com/379606/120575871-b1e62600-c3d6-11eb-9435-5dee19791294.mp4
62
+
53
63
  </td>
54
64
  <td>
55
65
 
56
66
  https://user-images.githubusercontent.com/379606/120575890-b7437080-c3d6-11eb-9c0a-3c563d1ee02a.mp4
67
+
57
68
  </td>
58
69
  </tr>
59
70
  </tbody>
@@ -72,6 +83,7 @@ Android (unlike iOS) does not support stretching of the provided image during la
72
83
  <td>
73
84
 
74
85
  https://user-images.githubusercontent.com/379606/120575878-b3afe980-c3d6-11eb-80c1-72441c22e8be.mp4
86
+
75
87
  </td>
76
88
  </tr>
77
89
  </tbody>
@@ -130,7 +142,7 @@ import * as SplashScreen from 'expo-splash-screen';
130
142
 
131
143
  // Prevent native splash screen from autohiding before App component declaration
132
144
  SplashScreen.preventAutoHideAsync()
133
- .then(result => console.log(`SplashScreen.preventAutoHideAsync() succeeded: ${result}`))
145
+ .then((result) => console.log(`SplashScreen.preventAutoHideAsync() succeeded: ${result}`))
134
146
  .catch(console.warn); // it's good to explicitly catch and inspect any error
135
147
 
136
148
  export default class App extends React.Component {
@@ -238,17 +250,13 @@ For bare React Native projects, you must ensure that you have [installed and con
238
250
  ## Add the package to your dependencies
239
251
 
240
252
  ```
241
- expo install expo-splash-screen
253
+ npx expo install expo-splash-screen
242
254
  ```
243
255
 
244
256
  ## 📱 Configure iOS
245
257
 
246
258
  Run `npx pod-install` after installing the package.
247
259
 
248
- ### Automatic configuration
249
-
250
- The easiest way to configure the splash screen in bare React Native projects is with the expo-splash-screen command. See the [README](https://github.com/expo/expo-cli/tree/main/unlinked-packages/configure-splash-screen) for more information, or run `yarn expo-splash-screen --help` in your project.
251
-
252
260
  ### Manual Configuration
253
261
 
254
262
  To achieve native splash screen (in iOS ecosystem it's called `LaunchScreen`) behavior, you have to provide either a `SplashScreen.storyboard` file or a `SplashScreen.xib` file, and configure your Xcode project accordingly.
@@ -499,10 +507,6 @@ You might want to customize the StatusBar appearance during the time the SplashS
499
507
 
500
508
  To achieve fully-native splash screen behavior, `expo-splash-screen` needs to be hooked into the native view hierarchy and consume some resources that have to be placed under `/android/app/src/res` directory.
501
509
 
502
- ### Automatic configuration
503
-
504
- The easiest way to configure the splash screen in bare React Native projects is with the expo-splash-screen command. See the [README](https://github.com/expo/expo-cli/tree/main/unlinked-packages/configure-splash-screen) for more information, or run `yarn expo-splash-screen --help` in your project.
505
-
506
510
  ### Manual Configuration
507
511
 
508
512
  1. [Configure `res/drawable/splashscreen_image.png`](#-configure-resdrawablesplashscreen_imagepng)
@@ -694,7 +698,6 @@ Create new color resource in your `res/values/colors.xml` (if your application s
694
698
 
695
699
  ```diff
696
700
  <resources>
697
- <!-- Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually -->
698
701
  <color name="splashscreen_background">#D0D0C0</color>
699
702
  + <color name="splashscreen_statusbar_color">#(AA)RRGGBB</color> <!-- #AARRGGBB or #RRGGBB format -->
700
703
  </resources>
@@ -772,7 +775,6 @@ We try to keep changes backward compatible, the code for `expo-splash-screen` wi
772
775
  setTheme(R.style.AppTheme);
773
776
  super.onCreate(null);
774
777
  - // SplashScreen.show(...) has to be called after super.onCreate(...)
775
- - // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
776
778
  - SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
777
779
  }
778
780
  ```
@@ -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.18.2'
6
+ version = '0.20.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -35,19 +35,11 @@ buildscript {
35
35
  }
36
36
  }
37
37
 
38
- // Creating sources with comments
39
- task androidSourcesJar(type: Jar) {
40
- classifier = 'sources'
41
- from android.sourceSets.main.java.srcDirs
42
- }
43
-
44
38
  afterEvaluate {
45
39
  publishing {
46
40
  publications {
47
41
  release(MavenPublication) {
48
42
  from components.release
49
- // Add additional sourcesJar to artifacts
50
- artifact(androidSourcesJar)
51
43
  }
52
44
  }
53
45
  repositories {
@@ -70,15 +62,21 @@ android {
70
62
  jvmTarget = JavaVersion.VERSION_11.majorVersion
71
63
  }
72
64
 
65
+ namespace "expo.modules.splashscreen"
73
66
  defaultConfig {
74
67
  minSdkVersion safeExtGet('minSdkVersion', 21)
75
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
69
  versionCode 17
77
- versionName '0.18.2'
70
+ versionName '0.20.0'
78
71
  }
79
72
  lintOptions {
80
73
  abortOnError false
81
74
  }
75
+ publishing {
76
+ singleVariant("release") {
77
+ withSourcesJar()
78
+ }
79
+ }
82
80
  }
83
81
 
84
82
  dependencies {
@@ -1,2 +1,2 @@
1
- <manifest package="expo.modules.splashscreen">
1
+ <manifest>
2
2
  </manifest>
@@ -1,13 +1,11 @@
1
1
  package expo.modules.splashscreen
2
2
 
3
- import android.content.Context
4
-
5
- import expo.modules.core.ExportedModule
6
- import expo.modules.core.ModuleRegistry
7
- import expo.modules.core.Promise
8
- import expo.modules.core.errors.CurrentActivityNotFoundException
9
- import expo.modules.core.interfaces.ActivityProvider
10
- import expo.modules.core.interfaces.ExpoMethod
3
+ import expo.modules.kotlin.Promise
4
+ import expo.modules.kotlin.exception.Exceptions
5
+ import expo.modules.kotlin.modules.Module
6
+ import expo.modules.kotlin.modules.ModuleDefinition
7
+ import expo.modules.splashscreen.exceptions.HideAsyncException
8
+ import expo.modules.splashscreen.exceptions.PreventAutoHideException
11
9
 
12
10
  // Below import must be kept unversioned even in versioned code to provide a redirection from
13
11
  // versioned code realm to unversioned code realm.
@@ -15,47 +13,30 @@ import expo.modules.core.interfaces.ExpoMethod
15
13
  // in versioned SplashScreen kotlin object that stores no information about the ExperienceActivity.
16
14
  import expo.modules.splashscreen.singletons.SplashScreen
17
15
 
18
- class SplashScreenModule(context: Context) : ExportedModule(context) {
19
- companion object {
20
- private const val NAME = "ExpoSplashScreen"
21
- private const val ERROR_TAG = "ERR_SPLASH_SCREEN"
22
- }
23
-
24
- private lateinit var activityProvider: ActivityProvider
25
-
26
- override fun getName(): String {
27
- return NAME
28
- }
16
+ class SplashScreenModule : Module() {
17
+ override fun definition() = ModuleDefinition {
18
+ Name("ExpoSplashScreen")
29
19
 
30
- override fun onCreate(moduleRegistry: ModuleRegistry) {
31
- activityProvider = moduleRegistry.getModule(ActivityProvider::class.java)
32
- }
20
+ AsyncFunction("preventAutoHideAsync") { promise: Promise ->
21
+ val currentActivity =
22
+ appContext.currentActivity ?: throw Exceptions.MissingActivity()
33
23
 
34
- @ExpoMethod
35
- fun preventAutoHideAsync(promise: Promise) {
36
- val activity = activityProvider.currentActivity
37
- if (activity == null) {
38
- promise.reject(CurrentActivityNotFoundException())
39
- return
24
+ SplashScreen.preventAutoHide(
25
+ currentActivity,
26
+ { hasEffect -> promise.resolve(hasEffect) },
27
+ { m -> promise.reject(PreventAutoHideException(m)) }
28
+ )
40
29
  }
41
- SplashScreen.preventAutoHide(
42
- activity,
43
- { hasEffect -> promise.resolve(hasEffect) },
44
- { m -> promise.reject(ERROR_TAG, m) }
45
- )
46
- }
47
30
 
48
- @ExpoMethod
49
- fun hideAsync(promise: Promise) {
50
- val activity = activityProvider.currentActivity
51
- if (activity == null) {
52
- promise.reject(CurrentActivityNotFoundException())
53
- return
31
+ AsyncFunction("hideAsync") { promise: Promise ->
32
+ val currentActivity =
33
+ appContext.currentActivity ?: throw Exceptions.MissingActivity()
34
+
35
+ SplashScreen.hide(
36
+ currentActivity,
37
+ { hasEffect -> promise.resolve(hasEffect) },
38
+ { m -> promise.reject(HideAsyncException(m)) }
39
+ )
54
40
  }
55
- SplashScreen.hide(
56
- activity,
57
- { hasEffect -> promise.resolve(hasEffect) },
58
- { m -> promise.reject(ERROR_TAG, m) }
59
- )
60
41
  }
61
42
  }
@@ -2,16 +2,11 @@ package expo.modules.splashscreen
2
2
 
3
3
  import android.content.Context
4
4
  import expo.modules.splashscreen.singletons.SplashScreen
5
- import expo.modules.core.BasePackage
6
- import expo.modules.core.ExportedModule
5
+ import expo.modules.core.interfaces.Package
7
6
  import expo.modules.core.interfaces.ReactActivityLifecycleListener
8
7
  import expo.modules.core.interfaces.SingletonModule
9
8
 
10
- class SplashScreenPackage : BasePackage() {
11
- override fun createExportedModules(context: Context): List<ExportedModule> {
12
- return listOf(SplashScreenModule(context))
13
- }
14
-
9
+ class SplashScreenPackage : Package {
15
10
  override fun createSingletonModules(context: Context?): List<SingletonModule> {
16
11
  return listOf(SplashScreen)
17
12
  }
@@ -32,7 +32,7 @@ class SplashScreenReactActivityLifecycleListener(activityContext: Context) : Rea
32
32
 
33
33
  private fun getResizeMode(context: Context): SplashScreenImageResizeMode =
34
34
  SplashScreenImageResizeMode.fromString(
35
- context.getString(R.string.expo_splash_screen_resize_mode).toLowerCase()
35
+ context.getString(R.string.expo_splash_screen_resize_mode).lowercase()
36
36
  )
37
37
  ?: SplashScreenImageResizeMode.CONTAIN
38
38
 
@@ -2,6 +2,7 @@ package expo.modules.splashscreen
2
2
 
3
3
  import android.app.Activity
4
4
  import android.os.Handler
5
+ import android.os.Looper
5
6
  import android.view.View
6
7
  import android.view.ViewGroup
7
8
  import expo.modules.splashscreen.exceptions.NoContentViewException
@@ -17,7 +18,7 @@ open class SplashScreenViewController(
17
18
  private val weakActivity = WeakReference(activity)
18
19
  private val contentView: ViewGroup = activity.findViewById(android.R.id.content)
19
20
  ?: throw NoContentViewException()
20
- private val handler = Handler()
21
+ private val handler = Handler(Looper.getMainLooper())
21
22
 
22
23
  private var autoHideEnabled = true
23
24
  private var splashScreenShown = false
@@ -0,0 +1,12 @@
1
+ package expo.modules.splashscreen.exceptions
2
+
3
+ import expo.modules.kotlin.exception.CodedException
4
+
5
+ class NoContentViewException :
6
+ CodedException("ContentView is not yet available. Call 'SplashScreen.show(...)' once 'setContentView()' is called.")
7
+
8
+ class PreventAutoHideException(message: String) :
9
+ CodedException(message)
10
+
11
+ class HideAsyncException(message: String) :
12
+ CodedException(message)
@@ -1,17 +1,10 @@
1
1
  package expo.modules.splashscreen.singletons
2
2
 
3
- import android.annotation.SuppressLint
4
3
  import android.app.Activity
5
- import android.os.Build
6
4
  import androidx.core.view.ViewCompat
7
5
 
8
6
  object SplashScreenStatusBar {
9
7
  fun configureTranslucent(activity: Activity, translucent: Boolean?) {
10
- @SuppressLint("ObsoleteSdkInt")
11
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
12
- return
13
- }
14
-
15
8
  translucent?.let {
16
9
  activity.runOnUiThread {
17
10
  // If the status bar is translucent hook into the window insets calculations
@@ -1,3 +1,3 @@
1
- declare const _default: import("expo-modules-core").ProxyNativeModule;
1
+ declare const _default: any;
2
2
  export default _default;
3
3
  //# sourceMappingURL=ExpoSplashScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSplashScreen.d.ts","sourceRoot":"","sources":["../src/ExpoSplashScreen.ts"],"names":[],"mappings":";AAEA,wBAAyD"}
1
+ {"version":3,"file":"ExpoSplashScreen.d.ts","sourceRoot":"","sources":["../src/ExpoSplashScreen.ts"],"names":[],"mappings":";AACA,wBAA6D"}
@@ -1,3 +1,3 @@
1
- import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExpoSplashScreen || {};
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExpoSplashScreen') || {};
3
3
  //# sourceMappingURL=ExpoSplashScreen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSplashScreen.js","sourceRoot":"","sources":["../src/ExpoSplashScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAe,kBAAkB,CAAC,gBAAgB,IAAI,EAAE,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\n\nexport default NativeModulesProxy.ExpoSplashScreen || {};\n"]}
1
+ {"version":3,"file":"ExpoSplashScreen.js","sourceRoot":"","sources":["../src/ExpoSplashScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoSplashScreen') || {};\n"]}
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "expo-splash-screen",
3
+ "platforms": ["ios", "android"],
4
+ "android": {
5
+ "modules": ["expo.modules.splashscreen.SplashScreenModule"]
6
+ }
7
+ }
@@ -17,6 +17,13 @@ Pod::Spec.new do |s|
17
17
  s.dependency 'ExpoModulesCore'
18
18
  s.dependency 'React-Core'
19
19
 
20
+ unless defined?(install_modules_dependencies)
21
+ # `install_modules_dependencies` is defined from react_native_pods.rb.
22
+ # when running with `pod ipc spec`, this method is not defined and we have to require manually.
23
+ require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
24
+ end
25
+ install_modules_dependencies(s)
26
+
20
27
  if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
21
28
  s.source_files = "#{s.name}/**/*.h"
22
29
  s.vendored_frameworks = "#{s.name}.xcframework"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-splash-screen",
3
- "version": "0.18.2",
3
+ "version": "0.20.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/index.js",
6
6
  "types": "build/index.d.ts",
@@ -37,8 +37,7 @@
37
37
  "preset": "expo-module-scripts"
38
38
  },
39
39
  "dependencies": {
40
- "@expo/configure-splash-screen": "^0.6.0",
41
- "@expo/prebuild-config": "6.0.1"
40
+ "@expo/prebuild-config": "6.2.0"
42
41
  },
43
42
  "devDependencies": {
44
43
  "expo-module-scripts": "^3.0.0"
@@ -46,5 +45,5 @@
46
45
  "peerDependencies": {
47
46
  "expo": "*"
48
47
  },
49
- "gitHead": "e0caa25c2d020381d351fe816e242fb48de91c63"
48
+ "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
50
49
  }
@@ -1,3 +1,2 @@
1
- import { NativeModulesProxy } from 'expo-modules-core';
2
-
3
- export default NativeModulesProxy.ExpoSplashScreen || {};
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExpoSplashScreen') || {};
@@ -1,9 +0,0 @@
1
- package expo.modules.splashscreen.exceptions
2
-
3
- import expo.modules.core.errors.CodedException
4
-
5
- class NoContentViewException : CodedException("ContentView is not yet available. Call 'SplashScreen.show(...)' once 'setContentView()' is called.") {
6
- override fun getCode(): String {
7
- return "ERR_NO_CONTENT_VIEW_FOUND"
8
- }
9
- }
package/unimodule.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "name": "expo-splash-screen",
3
- "platforms": ["ios", "android"]
4
- }