expo 43.0.3 → 44.0.0-beta.1

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.
@@ -8,7 +8,7 @@ apply from: "../scripts/autolinking.gradle"
8
8
  ensureDependeciesWereEvaluated(project)
9
9
 
10
10
  group = 'host.exp.exponent'
11
- version = '43.0.3'
11
+ version = '44.0.0-beta.1'
12
12
 
13
13
  buildscript {
14
14
  // Simple helper that allows the root project to override versions declared by this library.
@@ -62,7 +62,7 @@ android {
62
62
  minSdkVersion safeExtGet("minSdkVersion", 21)
63
63
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
64
64
  versionCode 1
65
- versionName "43.0.3"
65
+ versionName "44.0.0-beta.1"
66
66
  consumerProguardFiles("proguard-rules.pro")
67
67
  }
68
68
  lintOptions {
@@ -1,6 +1,7 @@
1
1
  # For ReactNativeDelegateWrapper
2
2
  -keepclassmembers public class com.facebook.react.ReactActivityDelegate {
3
3
  protected *;
4
+ private ReactDelegate mReactDelegate;
4
5
  }
5
6
 
6
7
  # For ReactNativeHostWrapper
@@ -2,21 +2,26 @@ package expo.modules
2
2
 
3
3
  import android.app.Application
4
4
  import android.content.res.Configuration
5
+ import androidx.annotation.UiThread
6
+ import expo.modules.core.interfaces.ApplicationLifecycleListener
5
7
 
6
- class ApplicationLifecycleDispatcher private constructor() {
7
- companion object {
8
- @JvmStatic
9
- fun onApplicationCreate(application: Application) {
10
- ExpoModulesPackage.packageList
11
- .flatMap { it.createApplicationLifecycleListeners(application) }
12
- .forEach { it.onCreate(application) }
13
- }
8
+ object ApplicationLifecycleDispatcher {
9
+ private var listeners: List<ApplicationLifecycleListener>? = null
14
10
 
15
- @JvmStatic
16
- fun onConfigurationChanged(application: Application, newConfig: Configuration) {
17
- ExpoModulesPackage.packageList
18
- .flatMap { it.createApplicationLifecycleListeners(application) }
19
- .forEach { it.onConfigurationChanged(newConfig) }
20
- }
11
+ @UiThread
12
+ private fun getCachedListeners(application: Application): List<ApplicationLifecycleListener> {
13
+ return listeners ?: ExpoModulesPackage.packageList
14
+ .flatMap { it.createApplicationLifecycleListeners(application) }
15
+ .also { listeners = it }
16
+ }
17
+
18
+ @JvmStatic
19
+ fun onApplicationCreate(application: Application) {
20
+ getCachedListeners(application).forEach { it.onCreate(application) }
21
+ }
22
+
23
+ @JvmStatic
24
+ fun onConfigurationChanged(application: Application, newConfig: Configuration) {
25
+ getCachedListeners(application).forEach { it.onConfigurationChanged(newConfig) }
21
26
  }
22
27
  }
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReactApplicationContext
8
8
  import com.facebook.react.uimanager.ViewManager
9
9
 
10
10
  import expo.modules.adapters.react.ModuleRegistryAdapter
11
+ import expo.modules.core.ModulePriorities
11
12
  import expo.modules.core.interfaces.Package
12
13
 
13
14
  import java.lang.Exception
@@ -21,9 +22,10 @@ class ExpoModulesPackage : ReactPackage {
21
22
  try {
22
23
  val expoModules = Class.forName("expo.modules.ExpoModulesPackageList")
23
24
  val getPackageList = expoModules.getMethod("getPackageList")
24
- getPackageList.invoke(null) as List<Package>
25
+ (getPackageList.invoke(null) as List<Package>)
26
+ .sortedByDescending { ModulePriorities.get(it::class.qualifiedName) }
25
27
  } catch (e: Exception) {
26
- Log.e("ExpoModulesPackage", "Couldn't get expo modules list.", e)
28
+ Log.e("ExpoModulesPackage", "Couldn't get expo package list.", e)
27
29
  emptyList()
28
30
  }
29
31
  }
@@ -8,6 +8,7 @@ import android.view.KeyEvent
8
8
  import androidx.collection.ArrayMap
9
9
  import com.facebook.react.ReactActivity
10
10
  import com.facebook.react.ReactActivityDelegate
11
+ import com.facebook.react.ReactDelegate
11
12
  import com.facebook.react.ReactInstanceManager
12
13
  import com.facebook.react.ReactNativeHost
13
14
  import com.facebook.react.ReactRootView
@@ -20,6 +21,8 @@ class ReactActivityDelegateWrapper(
20
21
  ) : ReactActivityDelegate(activity, null) {
21
22
  private val reactActivityLifecycleListeners = ExpoModulesPackage.packageList
22
23
  .flatMap { it.createReactActivityLifecycleListeners(activity) }
24
+ private val reactActivityHandlers = ExpoModulesPackage.packageList
25
+ .flatMap { it.createReactActivityHandlers(activity) }
23
26
  private val methodMap: ArrayMap<String, Method> = ArrayMap()
24
27
 
25
28
  //region ReactActivityDelegate
@@ -29,7 +32,9 @@ class ReactActivityDelegateWrapper(
29
32
  }
30
33
 
31
34
  override fun createRootView(): ReactRootView {
32
- return invokeDelegateMethod("createRootView")
35
+ return reactActivityHandlers.asSequence()
36
+ .mapNotNull { it.createReactRootView(activity) }
37
+ .firstOrNull() ?: invokeDelegateMethod("createRootView")
33
38
  }
34
39
 
35
40
  override fun getReactNativeHost(): ReactNativeHost {
@@ -49,7 +54,24 @@ class ReactActivityDelegateWrapper(
49
54
  }
50
55
 
51
56
  override fun onCreate(savedInstanceState: Bundle?) {
52
- invokeDelegateMethod<Unit, Bundle?>("onCreate", arrayOf(Bundle::class.java), arrayOf(savedInstanceState))
57
+ // Since we just wrap `ReactActivityDelegate` but not inherit it, in its `onCreate`,
58
+ // the calls to `createRootView()` or `getMainComponentName()` have no chances to be our wrapped methods.
59
+ // Instead we intercept `ReactActivityDelegate.onCreate` and replace the `mReactDelegate` with our version.
60
+ // That's not ideal but works.
61
+ val reactDelegate = object : ReactDelegate(
62
+ plainActivity, reactNativeHost, mainComponentName, launchOptions
63
+ ) {
64
+ override fun createRootView(): ReactRootView {
65
+ return this@ReactActivityDelegateWrapper.createRootView()
66
+ }
67
+ }
68
+ val mReactDelegate = ReactActivityDelegate::class.java.getDeclaredField("mReactDelegate")
69
+ mReactDelegate.isAccessible = true
70
+ mReactDelegate.set(delegate, reactDelegate)
71
+ if (mainComponentName != null) {
72
+ loadApp(mainComponentName)
73
+ }
74
+
53
75
  reactActivityLifecycleListeners.forEach { listener ->
54
76
  listener.onCreate(activity, savedInstanceState)
55
77
  }
@@ -124,6 +146,7 @@ class ReactActivityDelegateWrapper(
124
146
 
125
147
  //region Internals
126
148
 
149
+ @Suppress("UNCHECKED_CAST")
127
150
  private fun <T> invokeDelegateMethod(name: String): T {
128
151
  var method = methodMap[name]
129
152
  if (method == null) {
@@ -134,6 +157,7 @@ class ReactActivityDelegateWrapper(
134
157
  return method!!.invoke(delegate) as T
135
158
  }
136
159
 
160
+ @Suppress("UNCHECKED_CAST")
137
161
  private fun <T, A> invokeDelegateMethod(
138
162
  name: String,
139
163
  argTypes: Array<Class<*>>,
@@ -12,7 +12,6 @@ import com.facebook.react.bridge.JavaScriptContextHolder
12
12
  import com.facebook.react.bridge.JavaScriptExecutorFactory
13
13
  import com.facebook.react.bridge.ReactApplicationContext
14
14
  import com.facebook.react.devsupport.RedBoxHandler
15
- import com.facebook.react.uimanager.UIImplementationProvider
16
15
  import java.lang.reflect.Method
17
16
 
18
17
  class ReactNativeHostWrapper(
@@ -24,11 +23,20 @@ class ReactNativeHostWrapper(
24
23
  private val methodMap: ArrayMap<String, Method> = ArrayMap()
25
24
 
26
25
  override fun createReactInstanceManager(): ReactInstanceManager {
27
- // map() without asSequence() gives a chance for handlers
28
- // to get noticed before createReactInstanceManager()
29
- return reactNativeHostHandlers
30
- .map { it.createReactInstanceManager(useDeveloperSupport) }
26
+ val developerSupport = useDeveloperSupport
27
+ reactNativeHostHandlers.forEach { handler ->
28
+ handler.onWillCreateReactInstanceManager(developerSupport)
29
+ }
30
+
31
+ val result = reactNativeHostHandlers.asSequence()
32
+ .mapNotNull { it.createReactInstanceManager(developerSupport) }
31
33
  .firstOrNull() ?: super.createReactInstanceManager()
34
+
35
+ reactNativeHostHandlers.forEach { handler ->
36
+ handler.onDidCreateReactInstanceManager(result, developerSupport)
37
+ }
38
+
39
+ return result
32
40
  }
33
41
 
34
42
  override fun getRedBoxHandler(): RedBoxHandler? {
@@ -39,7 +47,8 @@ class ReactNativeHostWrapper(
39
47
  return invokeDelegateMethod("getJavaScriptExecutorFactory")
40
48
  }
41
49
 
42
- override fun getUIImplementationProvider(): UIImplementationProvider {
50
+ @Suppress("DEPRECATION")
51
+ override fun getUIImplementationProvider(): com.facebook.react.uimanager.UIImplementationProvider {
43
52
  return invokeDelegateMethod("getUIImplementationProvider")
44
53
  }
45
54
 
@@ -54,13 +63,13 @@ class ReactNativeHostWrapper(
54
63
 
55
64
  override fun getJSBundleFile(): String? {
56
65
  return reactNativeHostHandlers.asSequence()
57
- .map { it.getJSBundleFile(useDeveloperSupport) }
66
+ .mapNotNull { it.getJSBundleFile(useDeveloperSupport) }
58
67
  .firstOrNull() ?: invokeDelegateMethod<String?>("getJSBundleFile")
59
68
  }
60
69
 
61
70
  override fun getBundleAssetName(): String? {
62
71
  return reactNativeHostHandlers.asSequence()
63
- .map { it.getBundleAssetName(useDeveloperSupport) }
72
+ .mapNotNull { it.getBundleAssetName(useDeveloperSupport) }
64
73
  .firstOrNull() ?: invokeDelegateMethod<String?>("getBundleAssetName")
65
74
  }
66
75
 
@@ -90,6 +99,7 @@ class ReactNativeHostWrapper(
90
99
  }
91
100
  }
92
101
 
102
+ @Suppress("UNCHECKED_CAST")
93
103
  private fun <T> invokeDelegateMethod(name: String): T {
94
104
  var method = methodMap[name]
95
105
  if (method == null) {
package/build/Expo.fx.js CHANGED
@@ -19,21 +19,6 @@ const isManagedEnvironment = Constants.executionEnvironment === ExecutionEnviron
19
19
  if (StyleSheet.setStyleAttributePreprocessor) {
20
20
  StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);
21
21
  }
22
- // Add warning about removed navigator.geolocation polyfill.
23
- if (Platform.OS !== 'web' && !window.navigator?.geolocation) {
24
- const logLocationPolyfillWarning = (method) => {
25
- return () => {
26
- console.warn(`window.navigator.geolocation.${method} is not available. Import and execute installWebGeolocationPolyfill() from expo-location to add it, or use the expo-location APIs instead.`);
27
- };
28
- };
29
- // @ts-ignore
30
- window.navigator.geolocation = {
31
- getCurrentPosition: logLocationPolyfillWarning('getCurrentPosition'),
32
- watchPosition: logLocationPolyfillWarning('watchPostion'),
33
- clearWatch: () => { },
34
- stopObserving: () => { },
35
- };
36
- }
37
22
  // Asserts if bare workflow isn't setup correctly.
38
23
  if (NativeModulesProxy.ExpoUpdates?.isMissingRuntimeVersion) {
39
24
  const message = 'expo-updates is installed but there is no runtime or SDK version configured. ' +
@@ -1 +1 @@
1
- {"version":3,"file":"Expo.fx.js","sourceRoot":"","sources":["../src/Expo.fx.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,wEAAwE;AACxE,OAAO,0BAA0B,CAAC;AAClC,OAAO,oCAAoC,CAAC;AAC5C,mFAAmF;AACnF,OAAO,YAAY,CAAC;AAEpB,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAE5D,sGAAsG;AACtG,gGAAgG;AAChG,6EAA6E;AAC7E,MAAM,oBAAoB,GACxB,SAAS,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,UAAU;IAClE,SAAS,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,WAAW,CAAC;AAEtE,4FAA4F;AAC5F,IAAI,UAAU,CAAC,6BAA6B,EAAE;IAC5C,UAAU,CAAC,6BAA6B,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;CAChF;AAED,4DAA4D;AAC5D,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE;IAC3D,MAAM,0BAA0B,GAAG,CAAC,MAAc,EAAE,EAAE;QACpD,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,IAAI,CACV,gCAAgC,MAAM,4IAA4I,CACnL,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,aAAa;IACb,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG;QAC7B,kBAAkB,EAAE,0BAA0B,CAAC,oBAAoB,CAAC;QACpE,aAAa,EAAE,0BAA0B,CAAC,cAAc,CAAC;QACzD,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;KACxB,CAAC;CACH;AAED,kDAAkD;AAClD,IAAI,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,EAAE;IAC3D,MAAM,OAAO,GACX,+EAA+E;QAC/E,0DAA0D;QAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QACtE,yCAAyC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;CACF;AAED,0EAA0E;AAC1E,IAAI,OAAO,EAAE;IACX,2EAA2E;IAC3E,IAAI,oBAAoB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACjD,qDAAqD;QACrD,aAAa;QACb,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;QAE/D,aAAa;QACb,MAAM,mCAAmC,GAAG,WAAW,CAAC,2BAA2B,CAAC;QAEpF,aAAa;QACb,WAAW,CAAC,2BAA2B,GAAG,CAAC,QAAQ,EAAE,EAAE;YACrD,SAAS,wBAAwB,CAAC,KAAU;gBAC1C,MAAM,iBAAiB,GAAG,QAAQ,EAAE,CAAC;gBAErC,OAAO,CACL,oBAAC,eAAe;oBACd,oBAAC,iBAAiB,OAAK,KAAK,GAAI,CAChB,CACnB,CAAC;YACJ,CAAC;YAED,mCAAmC,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,CAAC;QACtE,CAAC,CAAC;KACH;CACF","sourcesContent":["import './environment/validate.fx';\n// load remote logging for compatibility with custom development clients\nimport './environment/logging.fx';\nimport './environment/react-native-logs.fx';\n// load expo-asset immediately to set a custom `source` transformer in React Native\nimport 'expo-asset';\n\nimport Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Font from 'expo-font';\nimport { NativeModulesProxy, Platform } from 'expo-modules-core';\nimport React from 'react';\nimport { AppRegistry, StyleSheet } from 'react-native';\n\nimport DevAppContainer from './environment/DevAppContainer';\n\n// Represents an app running in the store client or an app built with the legacy `expo build` command.\n// `false` when running in bare workflow, custom dev clients, or `eas build`s (managed or bare).\n// This should be used to ensure code that _should_ exist is treated as such.\nconst isManagedEnvironment =\n Constants.executionEnvironment === ExecutionEnvironment.Standalone ||\n Constants.executionEnvironment === ExecutionEnvironment.StoreClient;\n\n// If expo-font is installed and the style preprocessor is available, use it to parse fonts.\nif (StyleSheet.setStyleAttributePreprocessor) {\n StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);\n}\n\n// Add warning about removed navigator.geolocation polyfill.\nif (Platform.OS !== 'web' && !window.navigator?.geolocation) {\n const logLocationPolyfillWarning = (method: string) => {\n return () => {\n console.warn(\n `window.navigator.geolocation.${method} is not available. Import and execute installWebGeolocationPolyfill() from expo-location to add it, or use the expo-location APIs instead.`\n );\n };\n };\n\n // @ts-ignore\n window.navigator.geolocation = {\n getCurrentPosition: logLocationPolyfillWarning('getCurrentPosition'),\n watchPosition: logLocationPolyfillWarning('watchPostion'),\n clearWatch: () => {},\n stopObserving: () => {},\n };\n}\n\n// Asserts if bare workflow isn't setup correctly.\nif (NativeModulesProxy.ExpoUpdates?.isMissingRuntimeVersion) {\n const message =\n 'expo-updates is installed but there is no runtime or SDK version configured. ' +\n \"You'll need to configure one of these two properties in \" +\n Platform.select({ ios: 'Expo.plist', android: 'AndroidManifest.xml' }) +\n ' before OTA updates will work properly.';\n if (__DEV__) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n}\n\n// Having two if statements will enable terser to remove the entire block.\nif (__DEV__) {\n // Only enable the fast refresh indicator for managed iOS apps in dev mode.\n if (isManagedEnvironment && Platform.OS === 'ios') {\n // add the dev app container wrapper component on ios\n // @ts-ignore\n AppRegistry.setWrapperComponentProvider(() => DevAppContainer);\n\n // @ts-ignore\n const originalSetWrapperComponentProvider = AppRegistry.setWrapperComponentProvider;\n\n // @ts-ignore\n AppRegistry.setWrapperComponentProvider = (provider) => {\n function PatchedProviderComponent(props: any) {\n const ProviderComponent = provider();\n\n return (\n <DevAppContainer>\n <ProviderComponent {...props} />\n </DevAppContainer>\n );\n }\n\n originalSetWrapperComponentProvider(() => PatchedProviderComponent);\n };\n }\n}\n"]}
1
+ {"version":3,"file":"Expo.fx.js","sourceRoot":"","sources":["../src/Expo.fx.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,wEAAwE;AACxE,OAAO,0BAA0B,CAAC;AAClC,OAAO,oCAAoC,CAAC;AAC5C,mFAAmF;AACnF,OAAO,YAAY,CAAC;AAEpB,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAE5D,sGAAsG;AACtG,gGAAgG;AAChG,6EAA6E;AAC7E,MAAM,oBAAoB,GACxB,SAAS,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,UAAU;IAClE,SAAS,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,WAAW,CAAC;AAEtE,4FAA4F;AAC5F,IAAI,UAAU,CAAC,6BAA6B,EAAE;IAC5C,UAAU,CAAC,6BAA6B,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;CAChF;AAED,kDAAkD;AAClD,IAAI,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,EAAE;IAC3D,MAAM,OAAO,GACX,+EAA+E;QAC/E,0DAA0D;QAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QACtE,yCAAyC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;CACF;AAED,0EAA0E;AAC1E,IAAI,OAAO,EAAE;IACX,2EAA2E;IAC3E,IAAI,oBAAoB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACjD,qDAAqD;QACrD,aAAa;QACb,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;QAE/D,aAAa;QACb,MAAM,mCAAmC,GAAG,WAAW,CAAC,2BAA2B,CAAC;QAEpF,aAAa;QACb,WAAW,CAAC,2BAA2B,GAAG,CAAC,QAAQ,EAAE,EAAE;YACrD,SAAS,wBAAwB,CAAC,KAAU;gBAC1C,MAAM,iBAAiB,GAAG,QAAQ,EAAE,CAAC;gBAErC,OAAO,CACL,oBAAC,eAAe;oBACd,oBAAC,iBAAiB,OAAK,KAAK,GAAI,CAChB,CACnB,CAAC;YACJ,CAAC;YAED,mCAAmC,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,CAAC;QACtE,CAAC,CAAC;KACH;CACF","sourcesContent":["import './environment/validate.fx';\n// load remote logging for compatibility with custom development clients\nimport './environment/logging.fx';\nimport './environment/react-native-logs.fx';\n// load expo-asset immediately to set a custom `source` transformer in React Native\nimport 'expo-asset';\n\nimport Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Font from 'expo-font';\nimport { NativeModulesProxy, Platform } from 'expo-modules-core';\nimport React from 'react';\nimport { AppRegistry, StyleSheet } from 'react-native';\n\nimport DevAppContainer from './environment/DevAppContainer';\n\n// Represents an app running in the store client or an app built with the legacy `expo build` command.\n// `false` when running in bare workflow, custom dev clients, or `eas build`s (managed or bare).\n// This should be used to ensure code that _should_ exist is treated as such.\nconst isManagedEnvironment =\n Constants.executionEnvironment === ExecutionEnvironment.Standalone ||\n Constants.executionEnvironment === ExecutionEnvironment.StoreClient;\n\n// If expo-font is installed and the style preprocessor is available, use it to parse fonts.\nif (StyleSheet.setStyleAttributePreprocessor) {\n StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);\n}\n\n// Asserts if bare workflow isn't setup correctly.\nif (NativeModulesProxy.ExpoUpdates?.isMissingRuntimeVersion) {\n const message =\n 'expo-updates is installed but there is no runtime or SDK version configured. ' +\n \"You'll need to configure one of these two properties in \" +\n Platform.select({ ios: 'Expo.plist', android: 'AndroidManifest.xml' }) +\n ' before OTA updates will work properly.';\n if (__DEV__) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n}\n\n// Having two if statements will enable terser to remove the entire block.\nif (__DEV__) {\n // Only enable the fast refresh indicator for managed iOS apps in dev mode.\n if (isManagedEnvironment && Platform.OS === 'ios') {\n // add the dev app container wrapper component on ios\n // @ts-ignore\n AppRegistry.setWrapperComponentProvider(() => DevAppContainer);\n\n // @ts-ignore\n const originalSetWrapperComponentProvider = AppRegistry.setWrapperComponentProvider;\n\n // @ts-ignore\n AppRegistry.setWrapperComponentProvider = (provider) => {\n function PatchedProviderComponent(props: any) {\n const ProviderComponent = provider();\n\n return (\n <DevAppContainer>\n <ProviderComponent {...props} />\n </DevAppContainer>\n );\n }\n\n originalSetWrapperComponentProvider(() => PatchedProviderComponent);\n };\n }\n}\n"]}
@@ -1,112 +1,112 @@
1
1
  {
2
2
  "@expo/vector-icons": "^12.0.0",
3
3
  "@react-native-async-storage/async-storage": "~1.15.0",
4
- "@react-native-community/datetimepicker": "3.5.2",
5
- "@react-native-masked-view/masked-view": "0.2.5",
6
- "@react-native-community/netinfo": "6.0.2",
7
- "@react-native-community/slider": "4.1.7",
4
+ "@react-native-community/datetimepicker": "4.0.0",
5
+ "@react-native-masked-view/masked-view": "0.2.6",
6
+ "@react-native-community/netinfo": "7.1.3",
7
+ "@react-native-community/slider": "4.1.12",
8
8
  "@react-native-community/viewpager": "5.0.11",
9
- "@react-native-picker/picker": "2.1.0",
9
+ "@react-native-picker/picker": "2.2.1",
10
10
  "@react-native-segmented-control/segmented-control": "2.4.0",
11
- "@stripe/stripe-react-native": "0.2.2",
11
+ "@stripe/stripe-react-native": "0.2.3",
12
12
  "@unimodules/core": "~7.2.0",
13
13
  "@unimodules/react-native-adapter": "~6.5.0",
14
- "expo-ads-admob": "~11.0.3",
15
- "expo-ads-facebook": "~11.0.3",
16
- "expo-analytics-amplitude": "~11.0.3",
17
- "expo-analytics-segment": "~11.0.3",
18
- "expo-app-auth": "~11.0.3",
14
+ "expo-ads-admob": "~12.0.0",
15
+ "expo-ads-facebook": "~11.1.0",
16
+ "expo-analytics-amplitude": "~11.1.0",
17
+ "expo-analytics-segment": "~11.1.0",
18
+ "expo-app-auth": "~11.1.0",
19
19
  "expo-app-loader-provider": "~8.0.0",
20
- "expo-app-loading": "~1.2.1",
21
- "expo-apple-authentication": "~4.0.3",
22
- "expo-application": "~4.0.0",
23
- "expo-asset": "~8.4.3",
24
- "expo-auth-session": "~3.4.2",
25
- "expo-av": "~10.1.3",
26
- "expo-background-fetch": "~10.0.3",
27
- "expo-barcode-scanner": "~11.1.2",
28
- "expo-battery": "~6.0.3",
29
- "expo-blur": "~10.0.3",
30
- "expo-branch": "~5.0.3",
31
- "expo-brightness": "~10.0.3",
32
- "expo-calendar": "~10.0.3",
33
- "expo-camera": "~12.0.3",
34
- "expo-cellular": "~4.0.0",
20
+ "expo-app-loading": "~1.3.0",
21
+ "expo-apple-authentication": "~4.1.0",
22
+ "expo-application": "~4.0.1",
23
+ "expo-asset": "~8.4.4",
24
+ "expo-auth-session": "~3.5.0",
25
+ "expo-av": "~10.2.0",
26
+ "expo-background-fetch": "~10.1.0",
27
+ "expo-barcode-scanner": "~11.2.0",
28
+ "expo-battery": "~6.1.0",
29
+ "expo-blur": "~11.0.0",
30
+ "expo-branch": "~5.1.0",
31
+ "expo-brightness": "~10.1.0",
32
+ "expo-calendar": "~10.1.0",
33
+ "expo-camera": "~12.1.0",
34
+ "expo-cellular": "~4.1.0",
35
35
  "expo-checkbox": "~2.0.0",
36
- "expo-clipboard": "~2.0.3",
37
- "expo-constants": "~12.1.3",
38
- "expo-contacts": "~10.0.3",
39
- "expo-crypto": "~10.0.3",
40
- "expo-dev-client": "~0.6.3",
41
- "expo-device": "~4.0.3",
42
- "expo-document-picker": "~10.0.3",
43
- "expo-error-recovery": "~3.0.3",
44
- "expo-face-detector": "~11.0.3",
45
- "expo-facebook": "~12.0.3",
46
- "expo-file-system": "~13.0.3",
47
- "expo-firebase-analytics": "~5.0.3",
48
- "expo-firebase-core": "~4.0.3",
49
- "expo-firebase-recaptcha": "~2.0.2",
50
- "expo-font": "~10.0.3",
51
- "expo-gl": "~11.0.3",
52
- "expo-gl-cpp": "~11.0.1",
53
- "expo-google-app-auth": "~9.0.0",
54
- "expo-google-sign-in": "~10.0.3",
55
- "expo-haptics": "~11.0.3",
56
- "expo-image-loader": "~3.0.0",
57
- "expo-image-manipulator": "~10.1.2",
58
- "expo-image-picker": "~11.0.3",
59
- "expo-in-app-purchases": "~12.0.0",
60
- "expo-intent-launcher": "~10.0.3",
61
- "expo-keep-awake": "~10.0.0",
62
- "expo-linear-gradient": "~10.0.3",
63
- "expo-linking": "~2.4.2",
64
- "expo-local-authentication": "~12.0.1",
65
- "expo-localization": "~11.0.0",
66
- "expo-location": "~13.0.4",
67
- "expo-mail-composer": "~11.0.3",
68
- "expo-media-library": "~13.0.3",
69
- "expo-module-template": "~10.0.0",
70
- "expo-modules-core": "~0.4.8",
71
- "expo-navigation-bar": "~1.0.0",
72
- "expo-network": "~4.0.3",
73
- "expo-notifications": "~0.13.3",
74
- "expo-permissions": "~13.0.3",
75
- "expo-print": "~11.0.4",
76
- "expo-random": "~12.0.1",
77
- "expo-screen-orientation": "~4.0.3",
78
- "expo-secure-store": "~11.0.3",
79
- "expo-sensors": "~11.0.3",
80
- "expo-sharing": "~10.0.3",
81
- "expo-sms": "~10.0.3",
82
- "expo-speech": "~10.0.3",
83
- "expo-splash-screen": "~0.13.5",
84
- "expo-sqlite": "~10.0.3",
85
- "expo-status-bar": "~1.1.0",
86
- "expo-store-review": "~5.0.3",
87
- "expo-system-ui": "~1.0.0",
88
- "expo-task-manager": "~10.0.3",
89
- "expo-tracking-transparency": "~2.0.3",
90
- "expo-updates": "~0.10.15",
91
- "expo-video-thumbnails": "~6.0.3",
92
- "expo-web-browser": "~10.0.3",
93
- "lottie-react-native": "4.0.3",
36
+ "expo-clipboard": "~2.1.0",
37
+ "expo-constants": "~13.0.0",
38
+ "expo-contacts": "~10.1.0",
39
+ "expo-crypto": "~10.1.1",
40
+ "expo-dev-client": "~0.7.1",
41
+ "expo-device": "~4.1.0",
42
+ "expo-document-picker": "~10.1.0",
43
+ "expo-error-recovery": "~3.0.4",
44
+ "expo-face-detector": "~11.1.1",
45
+ "expo-facebook": "~12.1.0",
46
+ "expo-file-system": "~13.1.0",
47
+ "expo-firebase-analytics": "~6.0.0",
48
+ "expo-firebase-core": "~4.1.0",
49
+ "expo-firebase-recaptcha": "~2.1.0",
50
+ "expo-font": "~10.0.4",
51
+ "expo-gl": "~11.1.1",
52
+ "expo-gl-cpp": "~11.1.0",
53
+ "expo-google-app-auth": "~8.3.0",
54
+ "expo-google-sign-in": "~10.1.0",
55
+ "expo-haptics": "~11.1.0",
56
+ "expo-image-loader": "~3.1.0",
57
+ "expo-image-manipulator": "~10.2.0",
58
+ "expo-image-picker": "~12.0.0",
59
+ "expo-in-app-purchases": "~12.1.0",
60
+ "expo-intent-launcher": "~10.1.0",
61
+ "expo-keep-awake": "~10.0.1",
62
+ "expo-linear-gradient": "~11.0.0",
63
+ "expo-linking": "~3.0.0",
64
+ "expo-local-authentication": "~12.1.0",
65
+ "expo-localization": "~12.0.0",
66
+ "expo-location": "~14.0.0",
67
+ "expo-mail-composer": "~11.1.0",
68
+ "expo-media-library": "~14.0.0",
69
+ "expo-module-template": "~10.1.0",
70
+ "expo-modules-core": "~0.6.1",
71
+ "expo-navigation-bar": "~1.1.1",
72
+ "expo-network": "~4.1.0",
73
+ "expo-notifications": "~0.14.0",
74
+ "expo-permissions": "~13.1.0",
75
+ "expo-print": "~11.1.0",
76
+ "expo-random": "~12.1.0",
77
+ "expo-screen-orientation": "~4.1.1",
78
+ "expo-secure-store": "~11.1.0",
79
+ "expo-sensors": "~11.1.0",
80
+ "expo-sharing": "~10.1.0",
81
+ "expo-sms": "~10.1.0",
82
+ "expo-speech": "~10.1.0",
83
+ "expo-splash-screen": "~0.14.0",
84
+ "expo-sqlite": "~10.1.0",
85
+ "expo-status-bar": "~1.2.0",
86
+ "expo-store-review": "~5.1.0",
87
+ "expo-system-ui": "~1.1.0",
88
+ "expo-task-manager": "~10.1.0",
89
+ "expo-tracking-transparency": "~2.1.0",
90
+ "expo-updates": "~0.11.1",
91
+ "expo-video-thumbnails": "~6.1.0",
92
+ "expo-web-browser": "~10.1.0",
93
+ "lottie-react-native": "5.0.1",
94
94
  "react-native-appearance": "~0.3.3",
95
95
  "react-native-branch": "5.0.0",
96
- "react-native-gesture-handler": "~1.10.2",
96
+ "react-native-gesture-handler": "~2.0.0",
97
97
  "react-native-get-random-values": "~1.7.0",
98
- "react-native-maps": "0.28.0",
99
- "react-native-pager-view": "5.4.6",
100
- "react-native-reanimated": "~2.2.0",
98
+ "react-native-maps": "0.29.4",
99
+ "react-native-pager-view": "5.4.9",
100
+ "react-native-reanimated": "~2.3.0",
101
101
  "react-native-safe-area-context": "3.3.2",
102
- "react-native-screens": "~3.8.0",
103
- "react-native-shared-element": "0.8.2",
102
+ "react-native-screens": "~3.10.1",
103
+ "react-native-shared-element": "0.8.3",
104
104
  "react-native-svg": "12.1.1",
105
105
  "react-native-unimodules": "~0.15.0",
106
106
  "react-native-view-shot": "3.1.2",
107
- "react-native-webview": "11.13.0",
107
+ "react-native-webview": "11.15.0",
108
108
  "sentry-expo": "^4.0.0",
109
109
  "unimodules-app-loader": "~3.0.0",
110
110
  "unimodules-image-loader-interface": "~6.1.0",
111
- "unimodules-task-manager-interface": "~7.0.3"
111
+ "unimodules-task-manager-interface": "~7.1.0"
112
112
  }
@@ -0,0 +1,14 @@
1
+ // Copyright 2016-present 650 Industries. All rights reserved.
2
+
3
+ #import <Foundation/Foundation.h>
4
+
5
+ NS_ASSUME_NONNULL_BEGIN
6
+
7
+ /**
8
+ This class loads some preprocessors and pass into `EXAppDefines` of ExpoModulesCore.
9
+ */
10
+ @interface EXAppDefinesLoader : NSObject
11
+
12
+ @end
13
+
14
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,24 @@
1
+ // Copyright 2016-present 650 Industries. All rights reserved.
2
+
3
+ #import <Expo/EXAppDefinesLoader.h>
4
+
5
+ #import <ExpoModulesCore/ExpoModulesCore.h>
6
+ #import <React/RCTDefines.h>
7
+
8
+ @implementation EXAppDefinesLoader
9
+
10
+ + (void)load
11
+ {
12
+ BOOL APP_DEBUG;
13
+ [EXAppDefines load:@{
14
+ #if DEBUG
15
+ @"APP_DEBUG": @(YES),
16
+ #else
17
+ @"APP_DEBUG": @(NO),
18
+ #endif
19
+ @"APP_RCT_DEBUG": @(RCT_DEBUG),
20
+ @"APP_RCT_DEV": @(RCT_DEV),
21
+ }];
22
+ }
23
+
24
+ @end
package/ios/Expo.h CHANGED
@@ -1 +1,2 @@
1
1
  #import <ExpoModulesCore/ExpoModulesCore.h>
2
+ #import <Expo/EXAppDefinesLoader.h>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo",
3
- "version": "43.0.3",
3
+ "version": "44.0.0-beta.1",
4
4
  "description": "The Expo SDK",
5
5
  "main": "build/Expo.js",
6
6
  "module": "build/Expo.js",
@@ -55,39 +55,38 @@
55
55
  "homepage": "https://github.com/expo/expo/tree/master/packages/expo",
56
56
  "dependencies": {
57
57
  "@babel/runtime": "^7.14.0",
58
- "@expo/metro-config": "~0.1.84",
58
+ "@expo/metro-config": "~0.2.6",
59
59
  "@expo/vector-icons": "^12.0.4",
60
- "babel-preset-expo": "~8.5.1",
60
+ "babel-preset-expo": "~9.0.1",
61
61
  "cross-spawn": "^6.0.5",
62
- "expo-application": "~4.0.0",
63
- "expo-asset": "~8.4.3",
64
- "expo-constants": "~12.1.3",
65
- "expo-file-system": "~13.0.3",
66
- "expo-font": "~10.0.3",
67
- "expo-keep-awake": "~10.0.0",
68
- "expo-modules-autolinking": "~0.3.4",
69
- "expo-modules-core": "~0.4.8",
62
+ "expo-application": "~4.0.1",
63
+ "expo-asset": "~8.4.4",
64
+ "expo-constants": "~13.0.0",
65
+ "expo-file-system": "~13.1.0",
66
+ "expo-font": "~10.0.4",
67
+ "expo-keep-awake": "~10.0.1",
68
+ "expo-modules-autolinking": "0.5.0",
69
+ "expo-modules-core": "0.6.1",
70
70
  "fbemitter": "^2.1.1",
71
- "invariant": "^2.2.2",
71
+ "invariant": "^2.2.4",
72
72
  "md5-file": "^3.2.3",
73
- "pretty-format": "^26.4.0",
73
+ "pretty-format": "^26.5.2",
74
74
  "uuid": "^3.4.0"
75
75
  },
76
76
  "optionalDependencies": {
77
- "expo-error-recovery": "~3.0.3"
77
+ "expo-error-recovery": "~3.0.4"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/fbemitter": "^2.0.32",
81
- "@types/invariant": "^2.2.29",
82
- "@types/react": "^17.0.18",
81
+ "@types/invariant": "^2.2.33",
82
+ "@types/react": "~17.0.21",
83
83
  "@types/react-native": "~0.64.12",
84
84
  "@types/react-test-renderer": "^17.0.1",
85
85
  "@types/uuid": "^3.4.7",
86
- "expo-location": "^13.0.4",
87
86
  "expo-module-scripts": "^2.0.0",
88
87
  "react": "17.0.1",
89
88
  "react-dom": "17.0.1",
90
89
  "react-native": "0.64.3"
91
90
  },
92
- "gitHead": "a28a29bedc3cd5bb18e419e64c4856924a903c1b"
91
+ "gitHead": "cf8e7fde1b19e10dd9b74a8af0e9362ae8e14001"
93
92
  }
@@ -1,53 +0,0 @@
1
- /**
2
- * NOTE(brentvatne):
3
- * AppLoadingPlaceholder exists to smooth the upgrade experience to SDK 40. The
4
- * placeholder behaves mostly as expected with the existing API, however it
5
- * will no longer leverage any native APIs to keep the splash screen visible.
6
- * This makes it so a user who upgrades and runs their app can see their app
7
- * running and get the warning about the AppLoading module being removed
8
- * top, without an extraneous red screen that would appear from attempting to
9
- * render an undefined AppLoading component.
10
- *
11
- * Remove this in SDK 42.
12
- */
13
- import React from 'react';
14
- declare type Props = {
15
- /**
16
- * Optional, you can do this process manually if you prefer.
17
- * This is mainly for backwards compatibility and it is not recommended.
18
- *
19
- * When provided, requires providing `onError` prop as well.
20
- * @deprecated
21
- */
22
- startAsync: () => Promise<void>;
23
- /**
24
- * If `startAsync` throws an error, it is caught and passed into the provided function.
25
- * @deprecated
26
- */
27
- onError: (error: Error) => void;
28
- /**
29
- * Called when `startAsync` resolves or rejects.
30
- * This should be used to set state and unmount the `AppLoading` component.
31
- * @deprecated
32
- */
33
- onFinish: () => void;
34
- /**
35
- * Whether to hide the native splash screen as soon as you unmount the `AppLoading` component.
36
- * Auto-hiding is enabled by default.
37
- */
38
- autoHideSplash?: boolean;
39
- } | {
40
- /**
41
- * Whether to hide the native splash screen as soon as you unmount the `AppLoading` component.
42
- * Auto-hiding is enabled by default.
43
- */
44
- autoHideSplash?: boolean;
45
- };
46
- export default class AppLoadingPlaceholder extends React.Component<Props> {
47
- _isMounted: boolean;
48
- componentDidMount(): void;
49
- componentWillUnmount(): void;
50
- private startLoadingAppResourcesAsync;
51
- render(): null;
52
- }
53
- export {};
@@ -1,56 +0,0 @@
1
- /**
2
- * NOTE(brentvatne):
3
- * AppLoadingPlaceholder exists to smooth the upgrade experience to SDK 40. The
4
- * placeholder behaves mostly as expected with the existing API, however it
5
- * will no longer leverage any native APIs to keep the splash screen visible.
6
- * This makes it so a user who upgrades and runs their app can see their app
7
- * running and get the warning about the AppLoading module being removed
8
- * top, without an extraneous red screen that would appear from attempting to
9
- * render an undefined AppLoading component.
10
- *
11
- * Remove this in SDK 42.
12
- */
13
- import React from 'react';
14
- export default class AppLoadingPlaceholder extends React.Component {
15
- _isMounted = false;
16
- componentDidMount() {
17
- this._isMounted = true;
18
- this.startLoadingAppResourcesAsync().catch((error) => {
19
- console.error(`AppLoading threw an unexpected error when loading:\n${error.stack}`);
20
- });
21
- }
22
- componentWillUnmount() {
23
- this._isMounted = false;
24
- }
25
- async startLoadingAppResourcesAsync() {
26
- if (!('startAsync' in this.props)) {
27
- return;
28
- }
29
- if (!('onFinish' in this.props)) {
30
- throw new Error('AppLoading onFinish prop is required if startAsync is provided');
31
- }
32
- if (!('onError' in this.props)) {
33
- throw new Error('AppLoading onError prop is required if startAsync is provided');
34
- }
35
- try {
36
- await this.props.startAsync();
37
- }
38
- catch (e) {
39
- if (!this._isMounted) {
40
- return;
41
- }
42
- this.props.onError(e);
43
- }
44
- finally {
45
- if (!this._isMounted) {
46
- return;
47
- }
48
- // If we get to this point then we know that either there was no error, or the error was handled.
49
- this.props.onFinish();
50
- }
51
- }
52
- render() {
53
- return null;
54
- }
55
- }
56
- //# sourceMappingURL=AppLoadingPlaceholder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppLoadingPlaceholder.js","sourceRoot":"","sources":["../../src/launch/AppLoadingPlaceholder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAwC1B,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAAgB;IACvE,UAAU,GAAY,KAAK,CAAC;IAE5B,iBAAiB;QACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,IAAI,CAAC,6BAA6B,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACnD,OAAO,CAAC,KAAK,CAAC,uDAAuD,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACtF,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAEO,KAAK,CAAC,6BAA6B;QACzC,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;YACjC,OAAO;SACR;QAED,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;QAED,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;SAClF;QAED,IAAI;YACF,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;SAC/B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,OAAO;aACR;YACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACvB;gBAAS;YACR,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,OAAO;aACR;YACD,iGAAiG;YACjG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;SACvB;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/**\n * NOTE(brentvatne):\n * AppLoadingPlaceholder exists to smooth the upgrade experience to SDK 40. The\n * placeholder behaves mostly as expected with the existing API, however it\n * will no longer leverage any native APIs to keep the splash screen visible.\n * This makes it so a user who upgrades and runs their app can see their app\n * running and get the warning about the AppLoading module being removed\n * top, without an extraneous red screen that would appear from attempting to\n * render an undefined AppLoading component.\n *\n * Remove this in SDK 42.\n */\n\nimport React from 'react';\n\ntype Props =\n | {\n /**\n * Optional, you can do this process manually if you prefer.\n * This is mainly for backwards compatibility and it is not recommended.\n *\n * When provided, requires providing `onError` prop as well.\n * @deprecated\n */\n startAsync: () => Promise<void>;\n\n /**\n * If `startAsync` throws an error, it is caught and passed into the provided function.\n * @deprecated\n */\n onError: (error: Error) => void;\n\n /**\n * Called when `startAsync` resolves or rejects.\n * This should be used to set state and unmount the `AppLoading` component.\n * @deprecated\n */\n onFinish: () => void;\n\n /**\n * Whether to hide the native splash screen as soon as you unmount the `AppLoading` component.\n * Auto-hiding is enabled by default.\n */\n autoHideSplash?: boolean;\n }\n | {\n /**\n * Whether to hide the native splash screen as soon as you unmount the `AppLoading` component.\n * Auto-hiding is enabled by default.\n */\n autoHideSplash?: boolean;\n };\n\nexport default class AppLoadingPlaceholder extends React.Component<Props> {\n _isMounted: boolean = false;\n\n componentDidMount() {\n this._isMounted = true;\n\n this.startLoadingAppResourcesAsync().catch((error) => {\n console.error(`AppLoading threw an unexpected error when loading:\\n${error.stack}`);\n });\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n }\n\n private async startLoadingAppResourcesAsync() {\n if (!('startAsync' in this.props)) {\n return;\n }\n\n if (!('onFinish' in this.props)) {\n throw new Error('AppLoading onFinish prop is required if startAsync is provided');\n }\n\n if (!('onError' in this.props)) {\n throw new Error('AppLoading onError prop is required if startAsync is provided');\n }\n\n try {\n await this.props.startAsync();\n } catch (e) {\n if (!this._isMounted) {\n return;\n }\n this.props.onError(e);\n } finally {\n if (!this._isMounted) {\n return;\n }\n // If we get to this point then we know that either there was no error, or the error was handled.\n this.props.onFinish();\n }\n }\n\n render() {\n return null;\n }\n}\n"]}