expo-splash-screen 0.19.0 → 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,21 @@
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
+
13
28
  ## 0.19.0 — 2023-05-08
14
29
 
15
30
  ### 💡 Others
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
 
@@ -250,10 +257,6 @@ npx expo install expo-splash-screen
250
257
 
251
258
  Run `npx pod-install` after installing the package.
252
259
 
253
- ### Automatic configuration
254
-
255
- 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.
256
-
257
260
  ### Manual Configuration
258
261
 
259
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.
@@ -504,10 +507,6 @@ You might want to customize the StatusBar appearance during the time the SplashS
504
507
 
505
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.
506
509
 
507
- ### Automatic configuration
508
-
509
- 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.
510
-
511
510
  ### Manual Configuration
512
511
 
513
512
  1. [Configure `res/drawable/splashscreen_image.png`](#-configure-resdrawablesplashscreen_imagepng)
@@ -699,7 +698,6 @@ Create new color resource in your `res/values/colors.xml` (if your application s
699
698
 
700
699
  ```diff
701
700
  <resources>
702
- <!-- Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually -->
703
701
  <color name="splashscreen_background">#D0D0C0</color>
704
702
  + <color name="splashscreen_statusbar_color">#(AA)RRGGBB</color> <!-- #AARRGGBB or #RRGGBB format -->
705
703
  </resources>
@@ -777,7 +775,6 @@ We try to keep changes backward compatible, the code for `expo-splash-screen` wi
777
775
  setTheme(R.style.AppTheme);
778
776
  super.onCreate(null);
779
777
  - // SplashScreen.show(...) has to be called after super.onCreate(...)
780
- - // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
781
778
  - SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
782
779
  }
783
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.19.0'
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.19.0'
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
  }
@@ -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.19.0",
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.2"
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": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
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
- }