react-native 0.79.5 → 0.79.6

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 (28) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/React/Base/RCTVersion.m +1 -1
  3. package/ReactAndroid/gradle.properties +1 -1
  4. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +2 -2
  5. package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +3 -16
  6. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  7. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +13 -0
  8. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +0 -3
  9. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +26 -0
  10. package/ReactCommon/React-FabricComponents.podspec +5 -1
  11. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  12. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +12 -8
  13. package/ReactCommon/react/renderer/components/modal/CMakeLists.txt +4 -1
  14. package/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h +3 -2
  15. package/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +4 -12
  16. package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h +2 -2
  17. package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.mm +1 -1
  18. package/ReactCommon/react/renderer/components/modal/platform/android/JReactModalHostView.h +38 -0
  19. package/ReactCommon/react/renderer/components/modal/platform/android/ModalHostViewUtils.cpp +18 -0
  20. package/ReactCommon/react/renderer/components/modal/platform/cxx/ModalHostViewUtils.cpp +17 -0
  21. package/package.json +8 -8
  22. package/sdks/hermes-engine/hermes-utils.rb +4 -1
  23. package/sdks/hermesc/osx-bin/hermes +0 -0
  24. package/sdks/hermesc/osx-bin/hermesc +0 -0
  25. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  26. package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
  27. package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
  28. package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
@@ -16,6 +16,6 @@ export const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 79,
19
- patch: 5,
19
+ patch: 6,
20
20
  prerelease: null,
21
21
  };
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(79),
26
- RCTVersionPatch: @(5),
26
+ RCTVersionPatch: @(6),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.79.5
1
+ VERSION_NAME=0.79.6
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -1399,14 +1399,14 @@ public class ReactInstanceManager {
1399
1399
  new RuntimeException(
1400
1400
  "detachRootViewFromInstance called with ReactRootView with invalid id"));
1401
1401
  }
1402
-
1403
- clearReactRoot(reactRoot);
1404
1402
  } else {
1405
1403
  reactContext
1406
1404
  .getCatalystInstance()
1407
1405
  .getJSModule(AppRegistry.class)
1408
1406
  .unmountApplicationComponentAtRootTag(reactRoot.getRootViewTag());
1409
1407
  }
1408
+
1409
+ clearReactRoot(reactRoot);
1410
1410
  }
1411
1411
 
1412
1412
  @ThreadConfined(UI)
@@ -13,8 +13,6 @@ import android.os.Build
13
13
  import android.view.View
14
14
  import android.view.WindowInsetsController
15
15
  import android.view.WindowManager
16
- import androidx.core.view.ViewCompat
17
- import androidx.core.view.WindowInsetsCompat
18
16
  import com.facebook.common.logging.FLog
19
17
  import com.facebook.fbreact.specs.NativeStatusBarManagerAndroidSpec
20
18
  import com.facebook.react.bridge.GuardedRunnable
@@ -23,6 +21,7 @@ import com.facebook.react.bridge.ReactApplicationContext
23
21
  import com.facebook.react.bridge.UiThreadUtil
24
22
  import com.facebook.react.common.ReactConstants
25
23
  import com.facebook.react.module.annotations.ReactModule
24
+ import com.facebook.react.uimanager.DisplayMetricsHolder.getStatusBarHeightPx
26
25
  import com.facebook.react.uimanager.PixelUtil
27
26
  import com.facebook.react.views.view.setStatusBarTranslucency
28
27
  import com.facebook.react.views.view.setStatusBarVisibility
@@ -34,29 +33,17 @@ public class StatusBarModule(reactContext: ReactApplicationContext?) :
34
33
 
35
34
  @Suppress("DEPRECATION")
36
35
  override fun getTypedExportedConstants(): Map<String, Any> {
36
+ val currentActivity = reactApplicationContext.currentActivity
37
37
  val statusBarColor =
38
38
  currentActivity?.window?.statusBarColor?.let { color ->
39
39
  String.format("#%06X", 0xFFFFFF and color)
40
40
  } ?: "black"
41
41
  return mapOf(
42
- HEIGHT_KEY to PixelUtil.toDIPFromPixel(getStatusBarHeightPx()),
42
+ HEIGHT_KEY to PixelUtil.toDIPFromPixel(getStatusBarHeightPx(currentActivity).toFloat()),
43
43
  DEFAULT_BACKGROUND_COLOR_KEY to statusBarColor,
44
44
  )
45
45
  }
46
46
 
47
- @Suppress("DEPRECATION")
48
- private fun getStatusBarHeightPx(): Float {
49
- val windowInsets =
50
- currentActivity?.window?.decorView?.let(ViewCompat::getRootWindowInsets) ?: return 0f
51
- return windowInsets
52
- .getInsets(
53
- WindowInsetsCompat.Type.statusBars() or
54
- WindowInsetsCompat.Type.navigationBars() or
55
- WindowInsetsCompat.Type.displayCutout())
56
- .top
57
- .toFloat()
58
- }
59
-
60
47
  @Suppress("DEPRECATION")
61
48
  override fun setColor(colorDouble: Double, animated: Boolean) {
62
49
  val color = colorDouble.toInt()
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 79,
20
- "patch", 5,
20
+ "patch", 6,
21
21
  "prerelease", null);
22
22
  }
@@ -7,9 +7,12 @@
7
7
 
8
8
  package com.facebook.react.uimanager
9
9
 
10
+ import android.app.Activity
10
11
  import android.content.Context
11
12
  import android.util.DisplayMetrics
12
13
  import android.view.WindowManager
14
+ import androidx.core.view.ViewCompat
15
+ import androidx.core.view.WindowInsetsCompat
13
16
  import com.facebook.react.bridge.WritableMap
14
17
  import com.facebook.react.bridge.WritableNativeMap
15
18
 
@@ -99,4 +102,14 @@ public object DisplayMetricsHolder {
99
102
  putDouble("fontScale", fontScale)
100
103
  putDouble("densityDpi", displayMetrics.densityDpi.toDouble())
101
104
  }
105
+
106
+ internal fun getStatusBarHeightPx(activity: Activity?): Int {
107
+ val windowInsets = activity?.window?.decorView?.let(ViewCompat::getRootWindowInsets) ?: return 0
108
+ return windowInsets
109
+ .getInsets(
110
+ WindowInsetsCompat.Type.statusBars() or
111
+ WindowInsetsCompat.Type.navigationBars() or
112
+ WindowInsetsCompat.Type.displayCutout())
113
+ .top
114
+ }
102
115
  }
@@ -671,9 +671,6 @@ public class NativeViewHierarchyManager {
671
671
  View rootView = mTagsToViews.get(rootViewTag);
672
672
  dropView(rootView);
673
673
  mRootTags.delete(rootViewTag);
674
- if (rootView != null) {
675
- rootView.setId(View.NO_ID);
676
- }
677
674
  }
678
675
 
679
676
  /**
@@ -39,6 +39,8 @@ import com.facebook.react.bridge.WritableNativeMap
39
39
  import com.facebook.react.common.ReactConstants
40
40
  import com.facebook.react.common.annotations.VisibleForTesting
41
41
  import com.facebook.react.config.ReactFeatureFlags
42
+ import com.facebook.react.uimanager.DisplayMetricsHolder
43
+ import com.facebook.react.uimanager.DisplayMetricsHolder.getStatusBarHeightPx
42
44
  import com.facebook.react.uimanager.JSPointerDispatcher
43
45
  import com.facebook.react.uimanager.JSTouchDispatcher
44
46
  import com.facebook.react.uimanager.PixelUtil.pxToDp
@@ -52,6 +54,7 @@ import com.facebook.react.views.view.ReactViewGroup
52
54
  import com.facebook.react.views.view.setStatusBarTranslucency
53
55
  import com.facebook.react.views.view.setSystemBarsTranslucency
54
56
  import java.util.Objects
57
+ import com.facebook.yoga.annotations.DoNotStrip
55
58
 
56
59
  /**
57
60
  * ReactModalHostView is a view that sits in the view hierarchy representing a Modal view.
@@ -66,6 +69,7 @@ import java.util.Objects
66
69
  * addition and removal of views to the DialogRootViewGroup.
67
70
  */
68
71
  @SuppressLint("ViewConstructor")
72
+ @DoNotStrip
69
73
  public class ReactModalHostView(context: ThemedReactContext) :
70
74
  ViewGroup(context), LifecycleEventListener {
71
75
 
@@ -121,6 +125,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
121
125
  private var createNewDialog = false
122
126
 
123
127
  init {
128
+ initStatusBarHeight(context)
124
129
  dialogRootViewGroup = DialogRootViewGroup(context)
125
130
  }
126
131
 
@@ -448,6 +453,26 @@ public class ReactModalHostView(context: ThemedReactContext) :
448
453
 
449
454
  private companion object {
450
455
  private const val TAG = "ReactModalHost"
456
+
457
+ // We store the status bar height to be able to properly position
458
+ // the modal on the first render.
459
+ private var statusBarHeight = 0
460
+
461
+ private fun initStatusBarHeight(reactContext: ReactContext) {
462
+ statusBarHeight = getStatusBarHeightPx(reactContext.currentActivity)
463
+ }
464
+
465
+ @JvmStatic
466
+ @DoNotStrip
467
+ private fun getScreenDisplayMetricsWithoutInsets(): Long {
468
+ val displayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics()
469
+ return encodeFloatsToLong(
470
+ displayMetrics.widthPixels.toFloat().pxToDp(),
471
+ (displayMetrics.heightPixels - statusBarHeight).toFloat().pxToDp())
472
+ }
473
+
474
+ private fun encodeFloatsToLong(width: Float, height: Float): Long =
475
+ (width.toRawBits().toLong()) shl 32 or (height.toRawBits().toLong())
451
476
  }
452
477
 
453
478
  /**
@@ -463,6 +488,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
463
488
  */
464
489
  public class DialogRootViewGroup internal constructor(context: Context) :
465
490
  ReactViewGroup(context), RootView {
491
+
466
492
  internal var stateWrapper: StateWrapper? = null
467
493
  internal var eventDispatcher: EventDispatcher? = null
468
494
 
@@ -109,7 +109,11 @@ Pod::Spec.new do |s|
109
109
  sss.dependency folly_dep_name, folly_version
110
110
  sss.compiler_flags = folly_compiler_flags
111
111
  sss.source_files = "react/renderer/components/modal/**/*.{m,mm,cpp,h}"
112
- sss.exclude_files = "react/renderer/components/modal/tests"
112
+ sss.exclude_files = [
113
+ "react/renderer/components/modal/tests",
114
+ "react/renderer/components/modal/platform/android/**/*.{cpp,h}",
115
+ "react/renderer/components/modal/platform/cxx/**/*.{cpp,h}"
116
+ ]
113
117
  sss.header_dir = "react/renderer/components/modal"
114
118
  end
115
119
 
@@ -14,14 +14,14 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 79
17
- #define REACT_NATIVE_VERSION_PATCH 5
17
+ #define REACT_NATIVE_VERSION_PATCH 6
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 79;
24
- int32_t Patch = 5;
24
+ int32_t Patch = 6;
25
25
  std::string_view Prerelease = "";
26
26
  } ReactNativeVersion;
27
27
 
@@ -989,15 +989,19 @@ void JavaTurboModule::setEventEmitterCallback(
989
989
  *eventEmitterMap_[eventName].get());
990
990
  };
991
991
 
992
- jvalue arg;
993
- arg.l = JCxxCallbackImpl::newObjectCxxArgs([eventEmitterLookup = std::move(
994
- eventEmitterLookup)](
992
+ auto callback = JCxxCallbackImpl::newObjectCxxArgs([eventEmitterLookup = std::move(eventEmitterLookup)](
995
993
  folly::dynamic args) {
996
- auto eventName = args.at(0).asString();
997
- auto eventArgs = args.size() > 1 ? args.at(1) : nullptr;
998
- eventEmitterLookup(eventName).emit(std::move(eventArgs));
999
- }).release();
1000
- env->CallVoidMethod(instance, cachedMethodId, arg);
994
+ auto eventName = args.at(0).asString();
995
+ auto eventArgs = args.size() > 1 ? args.at(1) : nullptr;
996
+ eventEmitterLookup(eventName).emit(std::move(eventArgs));
997
+ });
998
+
999
+ jvalue args[1];
1000
+ args[0].l = callback.release();
1001
+ // CallVoidMethod is replaced with CallVoidMethodA as it's unsafe on 32bit and
1002
+ // causes crashes https://github.com/facebook/react-native/issues/51628
1003
+ env->CallVoidMethodA(instance_.get(), cachedMethodId, args);
1004
+ FACEBOOK_JNI_THROW_PENDING_EXCEPTION();
1001
1005
  }
1002
1006
 
1003
1007
  } // namespace facebook::react
@@ -14,7 +14,10 @@ add_compile_options(
14
14
  -Wpedantic
15
15
  -DLOG_TAG=\"Fabric\")
16
16
 
17
- file(GLOB rrc_modal_SRC CONFIGURE_DEPENDS *.cpp)
17
+ file(GLOB rrc_modal_SRC CONFIGURE_DEPENDS
18
+ *.cpp
19
+ platform/android/*.cpp)
20
+
18
21
  add_library(rrc_modal STATIC ${rrc_modal_SRC})
19
22
 
20
23
  target_include_directories(rrc_modal PUBLIC ${REACT_COMMON_DIR})
@@ -30,8 +30,9 @@ class ModalHostViewComponentDescriptor final
30
30
  *shadowNode.getState())
31
31
  .getData();
32
32
 
33
- layoutableShadowNode.setSize(
34
- Size{stateData.screenSize.width, stateData.screenSize.height});
33
+ layoutableShadowNode.setSize(Size{
34
+ .width = stateData.screenSize.width,
35
+ .height = stateData.screenSize.height});
35
36
  layoutableShadowNode.setPositionType(YGPositionTypeAbsolute);
36
37
 
37
38
  ConcreteComponentDescriptor::adopt(shadowNode);
@@ -9,15 +9,12 @@
9
9
 
10
10
  #include <react/renderer/core/graphicsConversions.h>
11
11
  #include <react/renderer/graphics/Float.h>
12
+ #include "ModalHostViewUtils.h"
12
13
 
13
14
  #ifdef ANDROID
14
15
  #include <folly/dynamic.h>
15
16
  #endif
16
17
 
17
- #if defined(__APPLE__) && TARGET_OS_IOS
18
- #include "ModalHostViewUtils.h"
19
- #endif
20
-
21
18
  namespace facebook::react {
22
19
 
23
20
  /*
@@ -27,12 +24,7 @@ class ModalHostViewState final {
27
24
  public:
28
25
  using Shared = std::shared_ptr<const ModalHostViewState>;
29
26
 
30
- #if defined(__APPLE__) && TARGET_OS_IOS
31
- ModalHostViewState() : screenSize(RCTModalHostViewScreenSize()) {
32
- #else
33
- ModalHostViewState(){
34
- #endif
35
- };
27
+ ModalHostViewState() : screenSize(ModalHostViewScreenSize()) {}
36
28
  ModalHostViewState(Size screenSize_) : screenSize(screenSize_){};
37
29
 
38
30
  #ifdef ANDROID
@@ -40,8 +32,8 @@ class ModalHostViewState final {
40
32
  const ModalHostViewState& previousState,
41
33
  folly::dynamic data)
42
34
  : screenSize(Size{
43
- (Float)data["screenWidth"].getDouble(),
44
- (Float)data["screenHeight"].getDouble()}){};
35
+ .width = (Float)data["screenWidth"].getDouble(),
36
+ .height = (Float)data["screenHeight"].getDouble()}){};
45
37
  #endif
46
38
 
47
39
  const Size screenSize{};
@@ -7,10 +7,10 @@
7
7
 
8
8
  #pragma once
9
9
 
10
- #include <react/renderer/core/graphicsConversions.h>
10
+ #include <react/renderer/graphics/Size.h>
11
11
 
12
12
  namespace facebook::react {
13
13
 
14
- Size RCTModalHostViewScreenSize(void);
14
+ Size ModalHostViewScreenSize(void);
15
15
 
16
16
  } // namespace facebook::react
@@ -11,7 +11,7 @@
11
11
 
12
12
  namespace facebook::react {
13
13
 
14
- Size RCTModalHostViewScreenSize(void)
14
+ Size ModalHostViewScreenSize(void)
15
15
  {
16
16
  CGSize screenSize = RCTScreenSize();
17
17
  return {screenSize.width, screenSize.height};
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include <react/renderer/graphics/Size.h>
12
+
13
+ namespace facebook::react {
14
+
15
+ class JReactModalHostView
16
+ : public facebook::jni::JavaClass<JReactModalHostView> {
17
+ public:
18
+ static auto constexpr kJavaDescriptor =
19
+ "Lcom/facebook/react/views/modal/ReactModalHostView;";
20
+
21
+ static Size getDisplayMetrics() {
22
+ static auto method =
23
+ JReactModalHostView::javaClassStatic()->getStaticMethod<jlong()>(
24
+ "getScreenDisplayMetricsWithoutInsets");
25
+ auto result = method(javaClassStatic());
26
+
27
+ // Inspired from yogaMeassureToSize from conversions.h
28
+ int32_t wBits = 0xFFFFFFFF & (result >> 32);
29
+ int32_t hBits = 0xFFFFFFFF & result;
30
+
31
+ auto* measuredWidth = reinterpret_cast<float*>(&wBits);
32
+ auto* measuredHeight = reinterpret_cast<float*>(&hBits);
33
+
34
+ return Size{.width = *measuredWidth, .height = *measuredHeight};
35
+ }
36
+ };
37
+
38
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include <react/renderer/components/modal/ModalHostViewUtils.h>
9
+ #include <react/renderer/graphics/Size.h>
10
+ #include "JReactModalHostView.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ Size ModalHostViewScreenSize() {
15
+ return JReactModalHostView::getDisplayMetrics();
16
+ }
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include <react/renderer/components/modal/ModalHostViewUtils.h>
9
+ #include <react/renderer/graphics/Size.h>
10
+
11
+ namespace facebook::react {
12
+
13
+ Size ModalHostViewScreenSize() {
14
+ return Size{0, 0};
15
+ }
16
+
17
+ } // namespace facebook::react
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.79.5",
3
+ "version": "0.79.6",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -109,13 +109,13 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@jest/create-cache-key-function": "^29.7.0",
112
- "@react-native/assets-registry": "0.79.5",
113
- "@react-native/codegen": "0.79.5",
114
- "@react-native/community-cli-plugin": "0.79.5",
115
- "@react-native/gradle-plugin": "0.79.5",
116
- "@react-native/js-polyfills": "0.79.5",
117
- "@react-native/normalize-colors": "0.79.5",
118
- "@react-native/virtualized-lists": "0.79.5",
112
+ "@react-native/assets-registry": "0.79.6",
113
+ "@react-native/codegen": "0.79.6",
114
+ "@react-native/community-cli-plugin": "0.79.6",
115
+ "@react-native/gradle-plugin": "0.79.6",
116
+ "@react-native/js-polyfills": "0.79.6",
117
+ "@react-native/normalize-colors": "0.79.6",
118
+ "@react-native/virtualized-lists": "0.79.6",
119
119
  "abort-controller": "^3.0.0",
120
120
  "anser": "^1.4.9",
121
121
  "ansi-regex": "^5.0.0",
@@ -204,7 +204,10 @@ def hermestag_file(react_native_path)
204
204
  end
205
205
 
206
206
  def release_tarball_url(version, build_type)
207
- maven_repo_url = "https://repo1.maven.org/maven2"
207
+ maven_repo_url =
208
+ ENV['ENTERPRISE_REPOSITORY'] != nil && ENV['ENTERPRISE_REPOSITORY'] != "" ?
209
+ ENV['ENTERPRISE_REPOSITORY'] :
210
+ "https://repo1.maven.org/maven2"
208
211
  namespace = "com/facebook/react"
209
212
  # Sample url from Maven:
210
213
  # https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz
Binary file
Binary file
Binary file
Binary file