react-native 0.81.0-rc.0 → 0.81.0-rc.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.
Files changed (97) hide show
  1. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -0
  2. package/Libraries/Blob/React-RCTBlob.podspec +1 -0
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/Image/React-RCTImage.podspec +1 -0
  5. package/Libraries/NativeAnimation/React-RCTAnimation.podspec +1 -0
  6. package/Libraries/Network/React-RCTNetwork.podspec +1 -0
  7. package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +4 -1
  8. package/Libraries/Settings/React-RCTSettings.podspec +1 -0
  9. package/Libraries/Vibration/React-RCTVibration.podspec +1 -0
  10. package/React/Base/RCTVersion.m +1 -1
  11. package/React/CoreModules/React-CoreModules.podspec +1 -0
  12. package/React/React-RCTFBReactNativeSpec.podspec +1 -0
  13. package/React/React-RCTFabric.podspec +1 -0
  14. package/React/Runtime/React-RCTRuntime.podspec +1 -0
  15. package/React-Core-prebuilt.podspec +2 -3
  16. package/React-Core.podspec +1 -4
  17. package/ReactAndroid/api/ReactAndroid.api +1 -1
  18. package/ReactAndroid/build.gradle.kts +2 -0
  19. package/ReactAndroid/gradle.properties +1 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt +1 -0
  21. package/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.kt +1 -0
  22. package/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt +2 -0
  23. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +36 -27
  24. package/ReactAndroid/src/main/java/com/facebook/react/ReactApplication.kt +4 -0
  25. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt +7 -2
  26. package/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.kt +4 -0
  27. package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +5 -5
  28. package/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.kt +3 -3
  29. package/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.kt +1 -0
  30. package/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.kt +2 -0
  31. package/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java +0 -2
  32. package/ReactAndroid/src/main/java/com/facebook/react/bridge/BridgeReactContext.java +18 -9
  33. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.kt +2 -0
  34. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.kt +1 -0
  35. package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java +4 -2
  36. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt +2 -0
  37. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +2 -0
  38. package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobProvider.kt +1 -1
  39. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  40. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.kt +1 -2
  41. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt +0 -2
  42. package/ReactCommon/React-Fabric.podspec +2 -1
  43. package/ReactCommon/React-FabricComponents.podspec +1 -0
  44. package/ReactCommon/React-FabricImage.podspec +1 -0
  45. package/ReactCommon/React-Mapbuffer.podspec +1 -1
  46. package/ReactCommon/ReactCommon.podspec +2 -1
  47. package/ReactCommon/cxxreact/React-cxxreact.podspec +1 -0
  48. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  49. package/ReactCommon/hermes/React-hermes.podspec +1 -0
  50. package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +2 -1
  51. package/ReactCommon/jsi/React-jsi.podspec +1 -0
  52. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +1 -0
  53. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +1 -0
  54. package/ReactCommon/jsinspector-modern/cdp/React-jsinspectorcdp.podspec +2 -1
  55. package/ReactCommon/jsinspector-modern/network/React-jsinspectornetwork.podspec +2 -1
  56. package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +2 -1
  57. package/ReactCommon/jsitooling/React-jsitooling.podspec +2 -1
  58. package/ReactCommon/logger/React-logger.podspec +1 -0
  59. package/ReactCommon/react/debug/React-debug.podspec +1 -1
  60. package/ReactCommon/react/featureflags/React-featureflags.podspec +2 -1
  61. package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +2 -1
  62. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -0
  63. package/ReactCommon/react/nativemodule/dom/React-domnativemodule.podspec +1 -0
  64. package/ReactCommon/react/nativemodule/featureflags/React-featureflagsnativemodule.podspec +1 -0
  65. package/ReactCommon/react/nativemodule/idlecallbacks/React-idlecallbacksnativemodule.podspec +1 -0
  66. package/ReactCommon/react/nativemodule/microtasks/React-microtasksnativemodule.podspec +1 -0
  67. package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -0
  68. package/ReactCommon/react/performance/timeline/React-performancetimeline.podspec +2 -1
  69. package/ReactCommon/react/renderer/core/ShadowNodeTraits.h +9 -0
  70. package/ReactCommon/react/renderer/css/React-renderercss.podspec +2 -2
  71. package/ReactCommon/react/renderer/debug/React-rendererdebug.podspec +2 -1
  72. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +2 -1
  73. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -0
  74. package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +2 -1
  75. package/ReactCommon/react/runtime/React-RuntimeCore.podspec +2 -1
  76. package/ReactCommon/react/runtime/React-RuntimeHermes.podspec +2 -1
  77. package/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec +2 -1
  78. package/ReactCommon/react/utils/React-utils.podspec +2 -1
  79. package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -0
  80. package/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +2 -1
  81. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +13 -10
  82. package/ReactCommon/yoga/yoga/node/Node.cpp +28 -0
  83. package/ReactCommon/yoga/yoga/node/Node.h +6 -4
  84. package/package.json +10 -10
  85. package/scripts/cocoapods/new_architecture.rb +1 -0
  86. package/scripts/cocoapods/rncore.rb +26 -9
  87. package/scripts/cocoapods/rndependencies.rb +6 -1
  88. package/scripts/cocoapods/utils.rb +16 -8
  89. package/scripts/codegen/templates/ReactCodegen.podspec.template +1 -0
  90. package/sdks/hermes-engine/hermes-utils.rb +6 -1
  91. package/sdks/hermesc/osx-bin/hermes +0 -0
  92. package/sdks/hermesc/osx-bin/hermesc +0 -0
  93. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  94. package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
  95. package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
  96. package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
  97. package/ReactAndroid/src/main/java/com/facebook/react/common/annotations/DeprecatedInNewArchitecture.kt +0 -16
@@ -84,4 +84,5 @@ Pod::Spec.new do |s|
84
84
 
85
85
  depend_on_js_engine(s)
86
86
  add_rn_third_party_dependencies(s)
87
+ add_rncore_dependency(s)
87
88
  end
@@ -55,4 +55,5 @@ Pod::Spec.new do |s|
55
55
  end
56
56
 
57
57
  add_rn_third_party_dependencies(s)
58
+ add_rncore_dependency(s)
58
59
  end
@@ -18,5 +18,5 @@ export const version: $ReadOnly<{
18
18
  major: 0,
19
19
  minor: 81,
20
20
  patch: 0,
21
- prerelease: 'rc.0',
21
+ prerelease: 'rc.1',
22
22
  };
@@ -53,4 +53,5 @@ Pod::Spec.new do |s|
53
53
  add_dependency(s, "React-NativeModulesApple")
54
54
 
55
55
  add_rn_third_party_dependencies(s)
56
+ add_rncore_dependency(s)
56
57
  end
@@ -50,4 +50,5 @@ Pod::Spec.new do |s|
50
50
  add_dependency(s, "React-featureflags")
51
51
 
52
52
  add_rn_third_party_dependencies(s)
53
+ add_rncore_dependency(s)
53
54
  end
@@ -52,4 +52,5 @@ Pod::Spec.new do |s|
52
52
  add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
53
53
 
54
54
  add_rn_third_party_dependencies(s)
55
+ add_rncore_dependency(s)
55
56
  end
@@ -18,6 +18,7 @@ end
18
18
 
19
19
  header_search_paths = [
20
20
  "\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
21
+ "\"${PODS_ROOT}/Headers/Public/React-RCTFBReactNativeSpec/FBReactNativeSpec\"",
21
22
  ]
22
23
 
23
24
  Pod::Spec.new do |s|
@@ -45,7 +46,9 @@ Pod::Spec.new do |s|
45
46
  s.dependency "React-Core/RCTPushNotificationHeaders"
46
47
  s.dependency "React-jsi"
47
48
 
48
- add_dependency(s, "React-RCTFBReactNativeSpec")
49
+ add_dependency(s, "React-RCTFBReactNativeSpec", :additional_framework_paths => ['FBReactNativeSpec'])
49
50
  add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
50
51
  add_dependency(s, "React-NativeModulesApple")
52
+
53
+ add_rncore_dependency(s)
51
54
  end
@@ -49,4 +49,5 @@ Pod::Spec.new do |s|
49
49
  add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
50
50
 
51
51
  add_rn_third_party_dependencies(s)
52
+ add_rncore_dependency(s)
52
53
  end
@@ -49,4 +49,5 @@ Pod::Spec.new do |s|
49
49
  add_dependency(s, "React-NativeModulesApple")
50
50
 
51
51
  add_rn_third_party_dependencies(s)
52
+ add_rncore_dependency(s)
52
53
  end
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(81),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.0",
27
+ RCTVersionPrerelease: @"rc.1",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -63,4 +63,5 @@ Pod::Spec.new do |s|
63
63
  add_dependency(s, "React-NativeModulesApple")
64
64
 
65
65
  add_rn_third_party_dependencies(s)
66
+ add_rncore_dependency(s)
66
67
  end
@@ -61,6 +61,7 @@ Pod::Spec.new do |s|
61
61
 
62
62
  depend_on_js_engine(s)
63
63
  add_rn_third_party_dependencies(s)
64
+ add_rncore_dependency(s)
64
65
 
65
66
  s.subspec "components" do |ss|
66
67
  ss.source_files = podspec_sources("FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{m,mm,cpp,h}", "FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{h}")
@@ -97,6 +97,7 @@ Pod::Spec.new do |s|
97
97
 
98
98
  depend_on_js_engine(s)
99
99
  add_rn_third_party_dependencies(s)
100
+ add_rncore_dependency(s)
100
101
 
101
102
  s.test_spec 'Tests' do |test_spec|
102
103
  test_spec.source_files = podspec_sources("Tests/**/*.{mm}", "")
@@ -68,4 +68,5 @@ Pod::Spec.new do |s|
68
68
 
69
69
  depend_on_js_engine(s)
70
70
  add_rn_third_party_dependencies(s)
71
+ add_rncore_dependency(s)
71
72
  end
@@ -62,8 +62,7 @@ Pod::Spec.new do |s|
62
62
  CONFIG="Debug"
63
63
  fi
64
64
 
65
- # TODO(T228219721): Add this for React Native Core as well
66
- ##### "$NODE_BINARY" "$REACT_NATIVE_PATH/third-party-podspecs/replace_dependencies_version.js" -c "$CONFIG" -r "#{version}" -p "$PODS_ROOT"
65
+ "$NODE_BINARY" "$REACT_NATIVE_PATH/scripts/replace-rncore-version.js" -c "$CONFIG" -r "#{version}" -p "$PODS_ROOT"
67
66
  EOS
68
67
  }
69
68
 
@@ -73,7 +72,7 @@ Pod::Spec.new do |s|
73
72
  # always run the script without warning
74
73
  script_phase[:always_out_of_date] = "1"
75
74
  end
76
-
75
+
77
76
  s.script_phase = script_phase
78
77
  end
79
78
  end
@@ -83,10 +83,6 @@ Pod::Spec.new do |s|
83
83
  ss.exclude_files = exclude_files
84
84
  ss.private_header_files = "React/Cxx*/*.h"
85
85
 
86
- # Include prebuilt if we're not building from source
87
- if !ReactNativeCoreUtils.build_rncore_from_source()
88
- ss.dependency "React-Core-prebuilt", version
89
- end
90
86
  end
91
87
 
92
88
  s.subspec "DevSupport" do |ss|
@@ -137,4 +133,5 @@ Pod::Spec.new do |s|
137
133
 
138
134
  depend_on_js_engine(s)
139
135
  add_rn_third_party_dependencies(s)
136
+ add_rncore_dependency(s)
140
137
  end
@@ -353,7 +353,7 @@ public abstract class com/facebook/react/ReactNativeHost {
353
353
  }
354
354
 
355
355
  public abstract interface class com/facebook/react/ReactPackage {
356
- public abstract fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
356
+ public fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
357
357
  public abstract fun createViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
358
358
  public fun getModule (Ljava/lang/String;Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/NativeModule;
359
359
  }
@@ -112,6 +112,8 @@ val preparePrefab by
112
112
  Pair(
113
113
  "../ReactCommon/react/renderer/animations/",
114
114
  "react/renderer/animations/"),
115
+ // react_renderer_bridging
116
+ Pair("../ReactCommon/react/renderer/bridging/", "react/renderer/bridging/"),
115
117
  // react_renderer_componentregistry
116
118
  Pair(
117
119
  "../ReactCommon/react/renderer/componentregistry/",
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.81.0-rc.0
1
+ VERSION_NAME=0.81.0-rc.1
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -22,6 +22,7 @@ import javax.inject.Provider
22
22
  /** Abstract class that supports lazy loading of NativeModules by default. */
23
23
  public abstract class BaseReactPackage : ReactPackage {
24
24
 
25
+ @Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
25
26
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
26
27
  throw UnsupportedOperationException(
27
28
  "createNativeModules method is not supported. Use getModule() method instead.")
@@ -112,6 +112,7 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
112
112
  * simply have a different mechanism for storing a `ReactNativeHost`, e.g. as a static field
113
113
  * somewhere.
114
114
  */
115
+ @Suppress("DEPRECATION")
115
116
  protected val reactNativeHost: ReactNativeHost
116
117
  get() = (application as ReactApplication).reactNativeHost
117
118
 
@@ -92,6 +92,8 @@ public abstract class LazyReactPackage : ReactPackage {
92
92
  * @param reactContext react application context that can be used to create modules
93
93
  * @return A [List]<[NativeModule]> to register
94
94
  */
95
+ @Suppress("DEPRECATION")
96
+ @Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
95
97
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
96
98
  buildList {
97
99
  for (holder in getNativeModules(reactContext)) {
@@ -18,20 +18,22 @@ import android.view.KeyEvent;
18
18
  import android.view.Window;
19
19
  import androidx.annotation.Nullable;
20
20
  import com.facebook.infer.annotation.Assertions;
21
+ import com.facebook.infer.annotation.Nullsafe;
21
22
  import com.facebook.react.bridge.Callback;
22
23
  import com.facebook.react.bridge.ReactContext;
23
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
24
24
  import com.facebook.react.interfaces.fabric.ReactSurface;
25
25
  import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags;
26
26
  import com.facebook.react.modules.core.PermissionListener;
27
27
  import com.facebook.react.views.view.WindowUtilKt;
28
28
  import com.facebook.systrace.Systrace;
29
+ import java.util.Objects;
29
30
 
30
31
  /**
31
32
  * Delegate class for {@link ReactActivity}. You can subclass this to provide custom implementations
32
33
  * for e.g. {@link #getReactNativeHost()}, if your Application class doesn't implement {@link
33
34
  * ReactApplication}.
34
35
  */
36
+ @Nullsafe(Nullsafe.Mode.LOCAL)
35
37
  public class ReactActivityDelegate {
36
38
 
37
39
  private final @Nullable Activity mActivity;
@@ -86,8 +88,11 @@ public class ReactActivityDelegate {
86
88
  * ReactApplication#getReactNativeHost()}. Override this method if your application class does not
87
89
  * implement {@code ReactApplication} or you simply have a different mechanism for storing a
88
90
  * {@code ReactNativeHost}, e.g. as a static field somewhere.
91
+ *
92
+ * @deprecated "Do not access {@link ReactNativeHost} directly. This class is going away in the
93
+ * New Architecture. You should access {@link ReactHost} instead."
89
94
  */
90
- @DeprecatedInNewArchitecture(message = "Use getReactHost()")
95
+ @Deprecated
91
96
  protected ReactNativeHost getReactNativeHost() {
92
97
  return ((ReactApplication) getPlainActivity().getApplication()).getReactNativeHost();
93
98
  }
@@ -107,16 +112,21 @@ public class ReactActivityDelegate {
107
112
  return mReactDelegate;
108
113
  }
109
114
 
110
- @DeprecatedInNewArchitecture(message = "Use getReactHost()")
115
+ /**
116
+ * @deprecated @deprecated "Do not access {@link ReactInstanceManager} directly. This class is
117
+ * going away in the New Architecture. You should access {@link ReactHost} instead."
118
+ * @noinspection deprecation
119
+ */
111
120
  public ReactInstanceManager getReactInstanceManager() {
112
- return mReactDelegate.getReactInstanceManager();
121
+ return Objects.requireNonNull(mReactDelegate).getReactInstanceManager();
113
122
  }
114
123
 
124
+ @Nullable
115
125
  public String getMainComponentName() {
116
126
  return mMainComponentName;
117
127
  }
118
128
 
119
- public void onCreate(Bundle savedInstanceState) {
129
+ public void onCreate(@Nullable Bundle savedInstanceState) {
120
130
  Systrace.traceSection(
121
131
  Systrace.TRACE_TAG_REACT,
122
132
  "ReactActivityDelegate.onCreate::init",
@@ -147,6 +157,7 @@ public class ReactActivityDelegate {
147
157
  launchOptions,
148
158
  isFabricEnabled()) {
149
159
  @Override
160
+ @Nullable
150
161
  protected ReactRootView createRootView() {
151
162
  ReactRootView rootView = ReactActivityDelegate.this.createRootView();
152
163
  if (rootView == null) {
@@ -162,31 +173,29 @@ public class ReactActivityDelegate {
162
173
  });
163
174
  }
164
175
 
165
- protected void loadApp(String appKey) {
166
- mReactDelegate.loadApp(appKey);
176
+ protected void loadApp(@Nullable String appKey) {
177
+ Objects.requireNonNull(mReactDelegate).loadApp(Objects.requireNonNull(appKey));
167
178
  getPlainActivity().setContentView(mReactDelegate.getReactRootView());
168
179
  }
169
180
 
170
181
  public void setReactSurface(ReactSurface reactSurface) {
171
- mReactDelegate.setReactSurface(reactSurface);
182
+ Objects.requireNonNull(mReactDelegate).setReactSurface(reactSurface);
172
183
  }
173
184
 
174
185
  public void setReactRootView(ReactRootView reactRootView) {
175
- mReactDelegate.setReactRootView(reactRootView);
186
+ Objects.requireNonNull(mReactDelegate).setReactRootView(reactRootView);
176
187
  }
177
188
 
178
189
  public void onUserLeaveHint() {
179
- if (mReactDelegate != null) {
180
- mReactDelegate.onUserLeaveHint();
181
- }
190
+ Objects.requireNonNull(mReactDelegate).onUserLeaveHint();
182
191
  }
183
192
 
184
193
  public void onPause() {
185
- mReactDelegate.onHostPause();
194
+ Objects.requireNonNull(mReactDelegate).onHostPause();
186
195
  }
187
196
 
188
197
  public void onResume() {
189
- mReactDelegate.onHostResume();
198
+ Objects.requireNonNull(mReactDelegate).onHostResume();
190
199
 
191
200
  if (mPermissionsCallback != null) {
192
201
  mPermissionsCallback.invoke();
@@ -195,43 +204,43 @@ public class ReactActivityDelegate {
195
204
  }
196
205
 
197
206
  public void onDestroy() {
198
- mReactDelegate.onHostDestroy();
207
+ Objects.requireNonNull(mReactDelegate).onHostDestroy();
199
208
  }
200
209
 
201
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
202
- mReactDelegate.onActivityResult(requestCode, resultCode, data, true);
210
+ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
211
+ Objects.requireNonNull(mReactDelegate).onActivityResult(requestCode, resultCode, data, true);
203
212
  }
204
213
 
205
214
  public boolean onKeyDown(int keyCode, KeyEvent event) {
206
- return mReactDelegate.onKeyDown(keyCode, event);
215
+ return Objects.requireNonNull(mReactDelegate).onKeyDown(keyCode, event);
207
216
  }
208
217
 
209
218
  public boolean onKeyUp(int keyCode, KeyEvent event) {
210
- return mReactDelegate.shouldShowDevMenuOrReload(keyCode, event);
219
+ return Objects.requireNonNull(mReactDelegate).shouldShowDevMenuOrReload(keyCode, event);
211
220
  }
212
221
 
213
222
  public boolean onKeyLongPress(int keyCode, KeyEvent event) {
214
- return mReactDelegate.onKeyLongPress(keyCode);
223
+ return Objects.requireNonNull(mReactDelegate).onKeyLongPress(keyCode);
215
224
  }
216
225
 
217
226
  public boolean onBackPressed() {
218
- return mReactDelegate.onBackPressed();
227
+ return Objects.requireNonNull(mReactDelegate).onBackPressed();
219
228
  }
220
229
 
221
- public boolean onNewIntent(Intent intent) {
222
- return mReactDelegate.onNewIntent(intent);
230
+ public boolean onNewIntent(@Nullable Intent intent) {
231
+ return Objects.requireNonNull(mReactDelegate).onNewIntent(Objects.requireNonNull(intent));
223
232
  }
224
233
 
225
234
  public void onWindowFocusChanged(boolean hasFocus) {
226
- mReactDelegate.onWindowFocusChanged(hasFocus);
235
+ Objects.requireNonNull(mReactDelegate).onWindowFocusChanged(hasFocus);
227
236
  }
228
237
 
229
238
  public void onConfigurationChanged(Configuration newConfig) {
230
- mReactDelegate.onConfigurationChanged(newConfig);
239
+ Objects.requireNonNull(mReactDelegate).onConfigurationChanged(newConfig);
231
240
  }
232
241
 
233
242
  public void requestPermissions(
234
- String[] permissions, int requestCode, PermissionListener listener) {
243
+ String[] permissions, int requestCode, @Nullable PermissionListener listener) {
235
244
  mPermissionListener = listener;
236
245
  getPlainActivity().requestPermissions(permissions, requestCode);
237
246
  }
@@ -267,7 +276,7 @@ public class ReactActivityDelegate {
267
276
  * context will no longer be valid.
268
277
  */
269
278
  public @Nullable ReactContext getCurrentReactContext() {
270
- return mReactDelegate.getCurrentReactContext();
279
+ return Objects.requireNonNull(mReactDelegate).getCurrentReactContext();
271
280
  }
272
281
 
273
282
  /**
@@ -10,6 +10,10 @@ package com.facebook.react
10
10
  /** Interface that represents an instance of a React Native application */
11
11
  public interface ReactApplication {
12
12
  /** Get the default [ReactNativeHost] for this app. */
13
+ @Suppress("DEPRECATION")
14
+ @Deprecated(
15
+ "You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
16
+ ReplaceWith("reactHost"))
13
17
  public val reactNativeHost: ReactNativeHost
14
18
 
15
19
  /**
@@ -14,7 +14,6 @@ import android.os.Bundle
14
14
  import android.view.KeyEvent
15
15
  import com.facebook.react.bridge.ReactContext
16
16
  import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
17
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
18
17
  import com.facebook.react.devsupport.DoubleTapReloadRecognizer
19
18
  import com.facebook.react.devsupport.ReleaseDevSupportManager
20
19
  import com.facebook.react.devsupport.interfaces.DevSupportManager
@@ -26,12 +25,17 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
26
25
  * A delegate for handling React Application support. This delegate is unaware whether it is used in
27
26
  * an [Activity] or a [android.app.Fragment].
28
27
  */
28
+ @Suppress("DEPRECATION")
29
29
  public open class ReactDelegate {
30
30
  private val activity: Activity
31
31
  private var internalReactRootView: ReactRootView? = null
32
32
  private val mainComponentName: String?
33
33
  private var launchOptions: Bundle?
34
34
  private var doubleTapReloadRecognizer: DoubleTapReloadRecognizer?
35
+
36
+ @Deprecated(
37
+ "You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
38
+ ReplaceWith("reactHost"))
35
39
  private var reactNativeHost: ReactNativeHost? = null
36
40
  public var reactHost: ReactHost? = null
37
41
  private set
@@ -380,7 +384,8 @@ public open class ReactDelegate {
380
384
  return false
381
385
  }
382
386
 
383
- @DeprecatedInNewArchitecture(message = "Use reactHost")
387
+ @Deprecated(
388
+ "Do not access [ReactInstanceManager] directly. This class is going away in the New Architecture. You should use [ReactHost] instead.")
384
389
  public fun getReactInstanceManager(): ReactInstanceManager {
385
390
  val nonNullReactNativeHost =
386
391
  checkNotNull(reactNativeHost) {
@@ -58,6 +58,10 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
58
58
  * method if your application class does not implement `ReactApplication` or you simply have a
59
59
  * different mechanism for storing a `ReactNativeHost`, e.g. as a static field somewhere.
60
60
  */
61
+ @Suppress("DEPRECATION")
62
+ @Deprecated(
63
+ "You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
64
+ ReplaceWith("reactHost"))
61
65
  protected open val reactNativeHost: ReactNativeHost?
62
66
  get() = (activity?.application as ReactApplication?)?.reactNativeHost
63
67
 
@@ -10,6 +10,7 @@ package com.facebook.react;
10
10
  import android.app.Application;
11
11
  import androidx.annotation.Nullable;
12
12
  import com.facebook.infer.annotation.Assertions;
13
+ import com.facebook.infer.annotation.Nullsafe;
13
14
  import com.facebook.react.bridge.JSExceptionHandler;
14
15
  import com.facebook.react.bridge.JavaScriptExecutorFactory;
15
16
  import com.facebook.react.bridge.ReactMarker;
@@ -18,7 +19,6 @@ import com.facebook.react.bridge.UIManagerProvider;
18
19
  import com.facebook.react.common.LifecycleState;
19
20
  import com.facebook.react.common.SurfaceDelegate;
20
21
  import com.facebook.react.common.SurfaceDelegateFactory;
21
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
22
22
  import com.facebook.react.common.annotations.internal.LegacyArchitecture;
23
23
  import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel;
24
24
  import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
@@ -32,12 +32,12 @@ import java.util.List;
32
32
  /**
33
33
  * Simple class that holds an instance of {@link ReactInstanceManager}. This can be used in your
34
34
  * {@link Application class} (see {@link ReactApplication}), or as a static field.
35
+ *
36
+ * @deprecated This class will be replaced by com.facebook.react.ReactHost in the New Architecture.
35
37
  */
36
- @DeprecatedInNewArchitecture(
37
- message =
38
- "This class will be replaced by com.facebook.react.ReactHost in the new architecture of"
39
- + " React Native.")
38
+ @Deprecated
40
39
  @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
40
+ @Nullsafe(Nullsafe.Mode.LOCAL)
41
41
  public abstract class ReactNativeHost {
42
42
 
43
43
  static {
@@ -10,7 +10,6 @@ package com.facebook.react
10
10
  import com.facebook.react.bridge.NativeModule
11
11
  import com.facebook.react.bridge.ReactApplicationContext
12
12
  import com.facebook.react.bridge.UIManager
13
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
14
13
  import com.facebook.react.common.annotations.StableReactNativeAPI
15
14
  import com.facebook.react.uimanager.ViewManager
16
15
 
@@ -34,8 +33,9 @@ public interface ReactPackage {
34
33
  * @return list of native modules to register with the newly created catalyst instance This method
35
34
  * is deprecated in the new Architecture of React Native.
36
35
  */
37
- @DeprecatedInNewArchitecture(message = "Migrate to BaseReactPackage and implement getModule")
38
- public fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule>
36
+ @Deprecated(message = "Migrate to [BaseReactPackage] and implement [getModule] instead.")
37
+ public fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
38
+ emptyList()
39
39
 
40
40
  /** @return a list of view managers that should be registered with [UIManager] */
41
41
  public fun createViewManagers(
@@ -28,6 +28,7 @@ internal object ReactPackageHelper {
28
28
  FLog.d(
29
29
  ReactConstants.TAG,
30
30
  "${reactPackage.javaClass.simpleName} is not a LazyReactPackage, falling back to old version.")
31
+ @Suppress("DEPRECATION")
31
32
  val nativeModules = reactPackage.createNativeModules(reactApplicationContext)
32
33
  return Iterable {
33
34
  object : Iterator<ModuleHolder> {
@@ -83,6 +83,7 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage
83
83
 
84
84
  if (shouldSupportLegacyPackages()) {
85
85
  // TODO(T145105887): Output warnings that ReactPackage was used
86
+ @Suppress("DEPRECATION")
86
87
  val nativeModules = reactPackage.createNativeModules(reactApplicationContext)
87
88
 
88
89
  val moduleMap: MutableMap<String, NativeModule> = mutableMapOf()
@@ -94,6 +95,7 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage
94
95
 
95
96
  val moduleName = reactModule?.name ?: module.name
96
97
 
98
+ @Suppress("DEPRECATION")
97
99
  val moduleInfo: ReactModuleInfo =
98
100
  if (reactModule != null)
99
101
  ReactModuleInfo(
@@ -16,7 +16,6 @@ import com.facebook.infer.annotation.Nullsafe;
16
16
  import com.facebook.infer.annotation.ThreadConfined;
17
17
  import com.facebook.proguard.annotations.DoNotStrip;
18
18
  import com.facebook.react.common.ReactConstants;
19
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
20
19
  import com.facebook.react.common.annotations.StableReactNativeAPI;
21
20
  import com.facebook.react.common.build.ReactBuildConfig;
22
21
  import java.util.Map;
@@ -72,7 +71,6 @@ public abstract class BaseJavaModule implements NativeModule {
72
71
  /**
73
72
  * @return a map of constants this module exports to JS. Supports JSON types.
74
73
  */
75
- @DeprecatedInNewArchitecture()
76
74
  public @Nullable Map<String, Object> getConstants() {
77
75
  return null;
78
76
  }
@@ -14,11 +14,11 @@ import androidx.annotation.NonNull;
14
14
  import androidx.annotation.Nullable;
15
15
  import com.facebook.common.logging.FLog;
16
16
  import com.facebook.infer.annotation.Assertions;
17
+ import com.facebook.infer.annotation.Nullsafe;
17
18
  import com.facebook.infer.annotation.ThreadConfined;
18
19
  import com.facebook.proguard.annotations.DoNotStrip;
19
20
  import com.facebook.react.bridge.queue.ReactQueueConfiguration;
20
21
  import com.facebook.react.common.ReactConstants;
21
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
22
22
  import com.facebook.react.common.annotations.FrameworkAPI;
23
23
  import com.facebook.react.common.annotations.UnstableReactNativeAPI;
24
24
  import com.facebook.react.common.annotations.VisibleForTesting;
@@ -27,16 +27,21 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
27
27
  import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
28
28
  import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
29
29
  import java.util.Collection;
30
+ import java.util.Objects;
30
31
 
31
32
  /**
32
33
  * This is the bridge-specific concrete subclass of ReactContext. ReactContext has many methods that
33
34
  * delegate to the react instance. This subclass implements those methods, by delegating to the
34
35
  * CatalystInstance. If you need to create a ReactContext within an "bridge context", please create
35
36
  * BridgeReactContext.
37
+ *
38
+ * @deprecated This class is deprecated in the New Architecture and will be replaced by {@link
39
+ * com.facebook.react.runtime.BridgelessReactContext}
36
40
  */
37
- @DeprecatedInNewArchitecture
38
41
  @VisibleForTesting
39
42
  @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
43
+ @Deprecated
44
+ @Nullsafe(Nullsafe.Mode.LOCAL)
40
45
  public class BridgeReactContext extends ReactApplicationContext {
41
46
  static {
42
47
  LegacyArchitectureLogger.assertLegacyArchitecture(
@@ -119,6 +124,7 @@ public class BridgeReactContext extends ReactApplicationContext {
119
124
  if (mCatalystInstance == null) {
120
125
  raiseCatalystInstanceMissingException();
121
126
  }
127
+ Assertions.assertNotNull(mCatalystInstance);
122
128
  return mCatalystInstance.hasNativeModule(nativeModuleInterface);
123
129
  }
124
130
 
@@ -127,6 +133,7 @@ public class BridgeReactContext extends ReactApplicationContext {
127
133
  if (mCatalystInstance == null) {
128
134
  raiseCatalystInstanceMissingException();
129
135
  }
136
+ Assertions.assertNotNull(mCatalystInstance);
130
137
  return mCatalystInstance.getNativeModules();
131
138
  }
132
139
 
@@ -139,6 +146,7 @@ public class BridgeReactContext extends ReactApplicationContext {
139
146
  if (mCatalystInstance == null) {
140
147
  raiseCatalystInstanceMissingException();
141
148
  }
149
+ Assertions.assertNotNull(mCatalystInstance);
142
150
  return mCatalystInstance.getNativeModule(nativeModuleInterface);
143
151
  }
144
152
 
@@ -147,6 +155,7 @@ public class BridgeReactContext extends ReactApplicationContext {
147
155
  if (mCatalystInstance == null) {
148
156
  raiseCatalystInstanceMissingException();
149
157
  }
158
+ Assertions.assertNotNull(mCatalystInstance);
150
159
  return mCatalystInstance.getNativeModule(moduleName);
151
160
  }
152
161
 
@@ -210,8 +219,7 @@ public class BridgeReactContext extends ReactApplicationContext {
210
219
  @Override
211
220
  public void handleException(Exception e) {
212
221
  boolean catalystInstanceVariableExists = mCatalystInstance != null;
213
- boolean isCatalystInstanceAlive =
214
- catalystInstanceVariableExists && !mCatalystInstance.isDestroyed();
222
+ boolean isCatalystInstanceAlive = mCatalystInstance != null && !mCatalystInstance.isDestroyed();
215
223
  boolean hasExceptionHandler = getJSExceptionHandler() != null;
216
224
 
217
225
  if (isCatalystInstanceAlive && hasExceptionHandler) {
@@ -268,18 +276,19 @@ public class BridgeReactContext extends ReactApplicationContext {
268
276
  return null;
269
277
  }
270
278
 
271
- @DeprecatedInNewArchitecture(
272
- message =
273
- "This method will be deprecated later as part of Stable APIs with bridge removal and not"
274
- + " encouraged usage.")
275
279
  /**
276
280
  * Get the UIManager for Fabric from the CatalystInstance.
277
281
  *
278
282
  * @return The UIManager when CatalystInstance is active.
283
+ * @deprecated Do not use this method. Instead use {@link
284
+ * com.facebook.react.uimanager.UIManagerHelper} method {@code getUIManager} to get the
285
+ * UIManager instance from the current ReactContext.
279
286
  */
280
287
  @Override
288
+ @Deprecated
281
289
  public @Nullable UIManager getFabricUIManager() {
282
- return mCatalystInstance.getFabricUIManager();
290
+ //noinspection deprecation
291
+ return Objects.requireNonNull(mCatalystInstance).getFabricUIManager();
283
292
  }
284
293
 
285
294
  /**
@@ -32,6 +32,8 @@ protected constructor(
32
32
  // do nothing
33
33
  }
34
34
 
35
+ @Deprecated(
36
+ "The method canOverrideExistingModule is not used in the New Architecture and will be removed in a future release.")
35
37
  override fun canOverrideExistingModule(): Boolean = false
36
38
 
37
39
  override fun invalidate() {