react-native-tvos 0.79.5-0 → 0.79.7-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 (36) hide show
  1. package/Libraries/Components/TV/TVFocusGuideView.js +5 -3
  2. package/Libraries/Core/ReactNativeVersion.js +4 -6
  3. package/React/Base/RCTVersion.m +3 -3
  4. package/ReactAndroid/gradle.properties +1 -1
  5. package/ReactAndroid/publish.gradle +2 -2
  6. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +2 -2
  7. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +18 -3
  8. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java +37 -19
  9. package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +3 -16
  10. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +3 -3
  11. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +13 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +0 -3
  13. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +33 -1
  14. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +7 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +6 -0
  16. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +15 -0
  17. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +2 -3
  18. package/ReactCommon/React-FabricComponents.podspec +5 -1
  19. package/ReactCommon/cxxreact/ReactNativeVersion.h +7 -3
  20. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +12 -8
  21. package/ReactCommon/react/renderer/components/modal/CMakeLists.txt +4 -1
  22. package/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h +3 -2
  23. package/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +4 -12
  24. package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h +2 -2
  25. package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.mm +1 -1
  26. package/ReactCommon/react/renderer/components/modal/platform/android/JReactModalHostView.h +38 -0
  27. package/ReactCommon/react/renderer/components/modal/platform/android/ModalHostViewUtils.cpp +18 -0
  28. package/ReactCommon/react/renderer/components/modal/platform/cxx/ModalHostViewUtils.cpp +17 -0
  29. package/package.json +8 -8
  30. package/sdks/hermes-engine/hermes-utils.rb +4 -1
  31. package/sdks/hermesc/osx-bin/hermes +0 -0
  32. package/sdks/hermesc/osx-bin/hermesc +0 -0
  33. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  34. package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
  35. package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
  36. package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
@@ -106,10 +106,12 @@ function TVFocusGuideView(
106
106
  });
107
107
 
108
108
  React.useEffect(() => {
109
- if (destinationsProp !== null && destinationsProp !== undefined) {
109
+ if (focusable === false) {
110
+ setDestinations([]);
111
+ } else if (destinationsProp !== null && destinationsProp !== undefined) {
110
112
  setDestinations(destinationsProp); // $FlowFixMe[incompatible-call]
111
113
  }
112
- }, [setDestinations, destinationsProp]);
114
+ }, [setDestinations, destinationsProp, focusable]);
113
115
 
114
116
  const enabledStyle = {display: enabled ? 'flex' : 'none'};
115
117
  const style = [styles.container, props.style, enabledStyle];
@@ -126,7 +128,7 @@ function TVFocusGuideView(
126
128
  style={style}
127
129
  ref={_setNativeRef}
128
130
  collapsable={false}
129
- autoFocus={autoFocus}
131
+ autoFocus={focusable === false ? true : autoFocus}
130
132
  // tvOS only prop
131
133
  isTVSelectable={tvOSSelectable}
132
134
  // Android TV only prop
@@ -5,10 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @flow strict
8
- * @generated by scripts/releases/set-rn-version.js
8
+ * @generated by scripts/releases/set-version.js
9
9
  */
10
10
 
11
- const version: $ReadOnly<{
11
+ export const version: $ReadOnly<{
12
12
  major: number,
13
13
  minor: number,
14
14
  patch: number,
@@ -16,8 +16,6 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 79,
19
- patch: 5,
20
- prerelease: '0',
19
+ patch: 7,
20
+ prerelease: '1',
21
21
  };
22
-
23
- module.exports = {version};
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated by scripts/releases/set-rn-version.js
7
+ * @generated by scripts/releases/set-version.js
8
8
  */
9
9
 
10
10
  #import "RCTVersion.h"
@@ -23,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(79),
26
- RCTVersionPatch: @(5),
27
- RCTVersionPrerelease: @"0",
26
+ RCTVersionPatch: @(7),
27
+ RCTVersionPrerelease: @"1",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.79.5-0
1
+ VERSION_NAME=0.79.7-1
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
 
4
4
  android.useAndroidX=true
@@ -20,7 +20,7 @@ def sonatypeUsername = findProperty('SONATYPE_USERNAME')
20
20
  def sonatypePassword = findProperty('SONATYPE_PASSWORD')
21
21
 
22
22
  def reactAndroidProjectDir = project(':packages:react-native:ReactAndroid').projectDir
23
- def mavenTempLocalUrl = 'file:///Users/expo/workingdir/build/maven_local'
23
+ def mavenTempLocalUrl = 'file:///home/expo/workingdir/build/maven-local'
24
24
  // Rewritten when copying this to ReactAndroid/publish.gradle
25
25
 
26
26
  publishing {
@@ -105,4 +105,4 @@ publishing {
105
105
  } else {
106
106
  logger.info('Signing disabled as the PGP key was not found')
107
107
  }
108
- }
108
+ }
@@ -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)
@@ -685,7 +685,15 @@ public class SurfaceMountingManager {
685
685
  return;
686
686
  }
687
687
 
688
- ViewState viewState = getViewState(reactTag);
688
+ ViewState viewState = getNullableViewState(reactTag);
689
+
690
+ if (viewState == null) {
691
+ ReactSoftExceptionLogger.logSoftException(
692
+ ReactSoftExceptionLogger.Categories.SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE,
693
+ new ReactNoCrashSoftException(
694
+ "Unable to find viewState for tag: " + reactTag + " for updateProps"));
695
+ return;
696
+ }
689
697
  viewState.mCurrentProps = new ReactStylesDiffMap(props);
690
698
  View view = viewState.mView;
691
699
 
@@ -833,9 +841,16 @@ public class SurfaceMountingManager {
833
841
  parent.requestLayout();
834
842
  }
835
843
 
836
- ViewState parentViewState = getViewState(parentTag);
844
+ // TODO T212247085: Make this non-nullable again after rolling out
845
+ // disableMountItemReorderingAndroid
846
+ ViewState parentViewState = getNullableViewState(parentTag);
837
847
  IViewGroupManager<?> parentViewManager = null;
838
- if (parentViewState.mViewManager != null) {
848
+ if (parentViewState == null) {
849
+ ReactSoftExceptionLogger.logSoftException(
850
+ ReactSoftExceptionLogger.Categories.SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE,
851
+ new ReactNoCrashSoftException(
852
+ "Unable to find viewState for tag: " + parentTag + " for updateLayout"));
853
+ } else if (parentViewState.mViewManager != null) {
839
854
  parentViewManager = (IViewGroupManager) parentViewState.mViewManager;
840
855
  }
841
856
  if (parentViewManager == null || !parentViewManager.needsCustomLayoutForChildren()) {
@@ -22,6 +22,7 @@ import com.facebook.react.fabric.mounting.SurfaceMountingManager;
22
22
  import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
23
23
  import com.facebook.react.uimanager.StateWrapper;
24
24
  import com.facebook.systrace.Systrace;
25
+ import java.util.Locale;
25
26
 
26
27
  /**
27
28
  * This class represents a batch of {@link MountItem}s, represented directly as int buffers to
@@ -199,7 +200,7 @@ final class IntBufferBatchMountItem implements BatchMountItem {
199
200
  public String toString() {
200
201
  try {
201
202
  StringBuilder s = new StringBuilder();
202
- s.append(String.format("IntBufferBatchMountItem [surface:%d]:\n", mSurfaceId));
203
+ s.append(String.format(Locale.ROOT, "IntBufferBatchMountItem [surface:%d]:\n", mSurfaceId));
203
204
  int i = 0, j = 0;
204
205
  while (i < mIntBufferLen) {
205
206
  int rawType = mIntBuffer[i++];
@@ -211,49 +212,65 @@ final class IntBufferBatchMountItem implements BatchMountItem {
211
212
  j += 3;
212
213
  s.append(
213
214
  String.format(
215
+ Locale.ROOT,
214
216
  "CREATE [%d] - layoutable:%d - %s\n",
215
- mIntBuffer[i++], mIntBuffer[i++], componentName));
217
+ mIntBuffer[i++],
218
+ mIntBuffer[i++],
219
+ componentName));
216
220
  } else if (type == INSTRUCTION_DELETE) {
217
- s.append(String.format("DELETE [%d]\n", mIntBuffer[i++]));
221
+ s.append(String.format(Locale.ROOT, "DELETE [%d]\n", mIntBuffer[i++]));
218
222
  } else if (type == INSTRUCTION_INSERT) {
219
223
  s.append(
220
224
  String.format(
221
- "INSERT [%d]->[%d] @%d\n", mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]));
225
+ Locale.ROOT,
226
+ "INSERT [%d]->[%d] @%d\n",
227
+ mIntBuffer[i++],
228
+ mIntBuffer[i++],
229
+ mIntBuffer[i++]));
222
230
  } else if (type == INSTRUCTION_REMOVE) {
223
231
  s.append(
224
232
  String.format(
225
- "REMOVE [%d]->[%d] @%d\n", mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]));
233
+ Locale.ROOT,
234
+ "REMOVE [%d]->[%d] @%d\n",
235
+ mIntBuffer[i++],
236
+ mIntBuffer[i++],
237
+ mIntBuffer[i++]));
226
238
  } else if (type == INSTRUCTION_UPDATE_PROPS) {
227
239
  Object props = mObjBuffer[j++];
228
240
  String propsString =
229
241
  IS_DEVELOPMENT_ENVIRONMENT
230
242
  ? (props != null ? props.toString() : "<null>")
231
243
  : "<hidden>";
232
- s.append(String.format("UPDATE PROPS [%d]: %s\n", mIntBuffer[i++], propsString));
244
+ s.append(
245
+ String.format(
246
+ Locale.ROOT, "UPDATE PROPS [%d]: %s\n", mIntBuffer[i++], propsString));
233
247
  } else if (type == INSTRUCTION_UPDATE_STATE) {
234
248
  StateWrapper state = (StateWrapper) mObjBuffer[j++];
235
249
  String stateString =
236
250
  IS_DEVELOPMENT_ENVIRONMENT
237
251
  ? (state != null ? state.toString() : "<null>")
238
252
  : "<hidden>";
239
- s.append(String.format("UPDATE STATE [%d]: %s\n", mIntBuffer[i++], stateString));
253
+ s.append(
254
+ String.format(
255
+ Locale.ROOT, "UPDATE STATE [%d]: %s\n", mIntBuffer[i++], stateString));
240
256
  } else if (type == INSTRUCTION_UPDATE_LAYOUT) {
241
- int reactTag = mIntBuffer[i++];
242
- int parentTag = mIntBuffer[i++];
243
- int x = mIntBuffer[i++];
244
- int y = mIntBuffer[i++];
245
- int w = mIntBuffer[i++];
246
- int h = mIntBuffer[i++];
247
- int displayType = mIntBuffer[i++];
248
- int layoutDirection = mIntBuffer[i++];
249
257
  s.append(
250
258
  String.format(
251
- "UPDATE LAYOUT [%d]->[%d]: x:%d y:%d w:%d h:%d displayType:%d layoutDirection:"
252
- + " %d\n",
253
- parentTag, reactTag, x, y, w, h, displayType, layoutDirection));
259
+ Locale.ROOT,
260
+ "UPDATE LAYOUT [%d]->[%d]: x:%d y:%d w:%d h:%d displayType:%d"
261
+ + " layoutDirection:%d\n",
262
+ mIntBuffer[i++],
263
+ mIntBuffer[i++],
264
+ mIntBuffer[i++],
265
+ mIntBuffer[i++],
266
+ mIntBuffer[i++],
267
+ mIntBuffer[i++],
268
+ mIntBuffer[i++],
269
+ mIntBuffer[i++]));
254
270
  } else if (type == INSTRUCTION_UPDATE_PADDING) {
255
271
  s.append(
256
272
  String.format(
273
+ Locale.ROOT,
257
274
  "UPDATE PADDING [%d]: top:%d right:%d bottom:%d left:%d\n",
258
275
  mIntBuffer[i++],
259
276
  mIntBuffer[i++],
@@ -263,6 +280,7 @@ final class IntBufferBatchMountItem implements BatchMountItem {
263
280
  } else if (type == INSTRUCTION_UPDATE_OVERFLOW_INSET) {
264
281
  s.append(
265
282
  String.format(
283
+ Locale.ROOT,
266
284
  "UPDATE OVERFLOWINSET [%d]: left:%d top:%d right:%d bottom:%d\n",
267
285
  mIntBuffer[i++],
268
286
  mIntBuffer[i++],
@@ -271,7 +289,7 @@ final class IntBufferBatchMountItem implements BatchMountItem {
271
289
  mIntBuffer[i++]));
272
290
  } else if (type == INSTRUCTION_UPDATE_EVENT_EMITTER) {
273
291
  j += 1;
274
- s.append(String.format("UPDATE EVENTEMITTER [%d]\n", mIntBuffer[i++]));
292
+ s.append(String.format(Locale.ROOT, "UPDATE EVENTEMITTER [%d]\n", mIntBuffer[i++]));
275
293
  } else {
276
294
  FLog.e(TAG, "String so far: " + s.toString());
277
295
  throw new IllegalArgumentException(
@@ -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()
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated by scripts/releases/set-rn-version.js
7
+ * @generated by scripts/releases/set-version.js
8
8
  */
9
9
 
10
10
  package com.facebook.react.modules.systeminfo;
@@ -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,
21
- "prerelease", "0");
20
+ "patch", 7,
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
  /**
@@ -42,6 +42,8 @@ import com.facebook.react.common.ReactConstants
42
42
  import com.facebook.react.common.annotations.VisibleForTesting
43
43
  import com.facebook.react.config.ReactFeatureFlags
44
44
  import com.facebook.react.modules.core.ReactAndroidHWInputDeviceHelper
45
+ import com.facebook.react.uimanager.DisplayMetricsHolder
46
+ import com.facebook.react.uimanager.DisplayMetricsHolder.getStatusBarHeightPx
45
47
  import com.facebook.react.uimanager.JSPointerDispatcher
46
48
  import com.facebook.react.uimanager.JSTouchDispatcher
47
49
  import com.facebook.react.uimanager.PixelUtil.pxToDp
@@ -55,6 +57,7 @@ import com.facebook.react.views.view.setStatusBarTranslucency
55
57
  import com.facebook.react.views.modal.ReactModalHostView.DialogRootViewGroup
56
58
  import com.facebook.react.views.view.ReactViewGroup
57
59
  import java.util.Objects
60
+ import com.facebook.yoga.annotations.DoNotStrip
58
61
 
59
62
 
60
63
  /**
@@ -70,6 +73,7 @@ import java.util.Objects
70
73
  * addition and removal of views to the DialogRootViewGroup.
71
74
  */
72
75
  @SuppressLint("ViewConstructor")
76
+ @DoNotStrip
73
77
  public class ReactModalHostView(context: ThemedReactContext) :
74
78
  ViewGroup(context), LifecycleEventListener {
75
79
 
@@ -120,6 +124,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
120
124
 
121
125
  init {
122
126
  context.addLifecycleEventListener(this)
127
+ initStatusBarHeight(context)
123
128
  dialogRootViewGroup = DialogRootViewGroup(context)
124
129
  }
125
130
 
@@ -163,7 +168,9 @@ public class ReactModalHostView(context: ThemedReactContext) :
163
168
  public override fun removeViewAt(index: Int) {
164
169
  UiThreadUtil.assertOnUiThread()
165
170
  val child = getChildAt(index)
166
- dialogRootViewGroup.removeView(child)
171
+ if (child != null) {
172
+ dialogRootViewGroup.removeView(child)
173
+ }
167
174
  }
168
175
 
169
176
  public override fun addChildrenForAccessibility(outChildren: ArrayList<View>) {
@@ -457,6 +464,30 @@ public class ReactModalHostView(context: ThemedReactContext) :
457
464
  public fun onRequestClose(dialog: DialogInterface?)
458
465
  }
459
466
 
467
+ private companion object {
468
+ private const val TAG = "ReactModalHost"
469
+
470
+ // We store the status bar height to be able to properly position
471
+ // the modal on the first render.
472
+ private var statusBarHeight = 0
473
+
474
+ private fun initStatusBarHeight(reactContext: ReactContext) {
475
+ statusBarHeight = getStatusBarHeightPx(reactContext.currentActivity)
476
+ }
477
+
478
+ @JvmStatic
479
+ @DoNotStrip
480
+ private fun getScreenDisplayMetricsWithoutInsets(): Long {
481
+ val displayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics()
482
+ return encodeFloatsToLong(
483
+ displayMetrics.widthPixels.toFloat().pxToDp(),
484
+ (displayMetrics.heightPixels - statusBarHeight).toFloat().pxToDp())
485
+ }
486
+
487
+ private fun encodeFloatsToLong(width: Float, height: Float): Long =
488
+ (width.toRawBits().toLong()) shl 32 or (height.toRawBits().toLong())
489
+ }
490
+
460
491
  /**
461
492
  * DialogRootViewGroup is the ViewGroup which contains all the children of a Modal. It gets all
462
493
  * child information forwarded from [ReactModalHostView] and uses that to create children. It is
@@ -470,6 +501,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
470
501
  */
471
502
  public class DialogRootViewGroup internal constructor(context: Context?) :
472
503
  ReactViewGroup(context), RootView {
504
+
473
505
  internal var stateWrapper: StateWrapper? = null
474
506
  internal var eventDispatcher: EventDispatcher? = null
475
507
 
@@ -409,8 +409,14 @@ public class ReactEditText extends AppCompatEditText {
409
409
  // that. This method will eventually replace requestFocusInternal()
410
410
  private boolean requestFocusProgramatically() {
411
411
  boolean focused = super.requestFocus(View.FOCUS_DOWN, null);
412
- if (isInTouchMode() && getShowSoftInputOnFocus()) {
412
+ if (getShowSoftInputOnFocus()) {
413
413
  showSoftKeyboard();
414
+ } else {
415
+ if (isKeyboardOpened) {
416
+ showSoftKeyboard();
417
+ } else {
418
+ hideSoftKeyboard();
419
+ }
414
420
  }
415
421
 
416
422
  return focused;
@@ -981,6 +981,12 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
981
981
  view.setAutoFocus(autoFocus);
982
982
  }
983
983
 
984
+ @ReactProp(name = "accessible")
985
+ public void setAccessible(ReactEditText view, boolean accessible) {
986
+ view.setFocusable(accessible);
987
+ view.setFocusableInTouchMode(accessible);
988
+ }
989
+
984
990
  @ReactProp(name = ViewProps.TEXT_DECORATION_LINE)
985
991
  public void setTextDecorationLine(ReactEditText view, @Nullable String textDecorationLineString) {
986
992
  view.setPaintFlags(
@@ -692,6 +692,20 @@ public class ReactViewGroup extends ViewGroup
692
692
  return ViewUtil.getUIManagerType(getId()) == UIManagerType.FABRIC;
693
693
  }
694
694
 
695
+ @Override
696
+ public void removeView(View view) {
697
+ onViewRemoved(view);
698
+ recoverFocus(view);
699
+ super.removeView(view);
700
+ }
701
+
702
+ @Override
703
+ public void removeViewAt(int index) {
704
+ onViewRemoved(getChildAt(index));
705
+ recoverFocus(getChildAt(index));
706
+ super.removeViewAt(index);
707
+ }
708
+
695
709
  @Override
696
710
  public void onViewAdded(View child) {
697
711
  UiThreadUtil.assertOnUiThread();
@@ -855,6 +869,7 @@ public class ReactViewGroup extends ViewGroup
855
869
  /*package*/ void removeViewWithSubviewClippingEnabled(View view) {
856
870
  UiThreadUtil.assertOnUiThread();
857
871
 
872
+ recoverFocus(view);
858
873
  Assertions.assertCondition(mRemoveClippedSubviews);
859
874
  Assertions.assertNotNull(mClippingRect);
860
875
  View[] childArray = Assertions.assertNotNull(mAllChildren);
@@ -107,7 +107,7 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
107
107
  view.isFocusable = false
108
108
  view.descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
109
109
  } else {
110
- view.descendantFocusability = ViewGroup.FOCUS_BEFORE_DESCENDANTS
110
+ view.descendantFocusability = ViewGroup.FOCUS_AFTER_DESCENDANTS
111
111
  }
112
112
  }
113
113
 
@@ -363,8 +363,7 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
363
363
  } else {
364
364
  view.setOnClickListener(null)
365
365
  view.isClickable = false
366
- // Don't set view.setFocusable(false) because we might still want it to be focusable for
367
- // accessibility reasons
366
+ view.isFocusable = false
368
367
  }
369
368
  }
370
369
 
@@ -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
 
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated by scripts/releases/set-rn-version.js
7
+ * @generated by scripts/releases/set-version.js
8
8
  */
9
9
 
10
10
  #pragma once
@@ -12,13 +12,17 @@
12
12
  #include <cstdint>
13
13
  #include <string_view>
14
14
 
15
+ #define REACT_NATIVE_VERSION_MAJOR 0
16
+ #define REACT_NATIVE_VERSION_MINOR 79
17
+ #define REACT_NATIVE_VERSION_PATCH 7
18
+
15
19
  namespace facebook::react {
16
20
 
17
21
  constexpr struct {
18
22
  int32_t Major = 0;
19
23
  int32_t Minor = 79;
20
- int32_t Patch = 5;
21
- std::string_view Prerelease = "0";
24
+ int32_t Patch = 7;
25
+ std::string_view Prerelease = "1";
22
26
  } ReactNativeVersion;
23
27
 
24
28
  } // namespace facebook::react
@@ -983,15 +983,19 @@ void JavaTurboModule::setEventEmitterCallback(
983
983
  *eventEmitterMap_[eventName].get());
984
984
  };
985
985
 
986
- jvalue arg;
987
- arg.l = JCxxCallbackImpl::newObjectCxxArgs([eventEmitterLookup = std::move(
988
- eventEmitterLookup)](
986
+ auto callback = JCxxCallbackImpl::newObjectCxxArgs([eventEmitterLookup = std::move(eventEmitterLookup)](
989
987
  folly::dynamic args) {
990
- auto eventName = args.at(0).asString();
991
- auto eventArgs = args.size() > 1 ? args.at(1) : nullptr;
992
- eventEmitterLookup(eventName).emit(std::move(eventArgs));
993
- }).release();
994
- env->CallVoidMethod(instance, cachedMethodId, arg);
988
+ auto eventName = args.at(0).asString();
989
+ auto eventArgs = args.size() > 1 ? args.at(1) : nullptr;
990
+ eventEmitterLookup(eventName).emit(std::move(eventArgs));
991
+ });
992
+
993
+ jvalue args[1];
994
+ args[0].l = callback.release();
995
+ // CallVoidMethod is replaced with CallVoidMethodA as it's unsafe on 32bit and
996
+ // causes crashes https://github.com/facebook/react-native/issues/51628
997
+ env->CallVoidMethodA(instance_.get(), cachedMethodId, args);
998
+ FACEBOOK_JNI_THROW_PENDING_EXCEPTION();
995
999
  }
996
1000
 
997
1001
  } // 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-tvos",
3
- "version": "0.79.5-0",
3
+ "version": "0.79.7-1",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -113,12 +113,12 @@
113
113
  },
114
114
  "dependencies": {
115
115
  "@jest/create-cache-key-function": "^29.7.0",
116
- "@react-native/assets-registry": "0.79.5",
117
- "@react-native/codegen": "0.79.5",
118
- "@react-native/community-cli-plugin": "0.79.5",
119
- "@react-native/gradle-plugin": "0.79.5",
120
- "@react-native/js-polyfills": "0.79.5",
121
- "@react-native/normalize-colors": "0.79.5",
116
+ "@react-native/assets-registry": "0.79.7",
117
+ "@react-native/codegen": "0.79.7",
118
+ "@react-native/community-cli-plugin": "0.79.7",
119
+ "@react-native/gradle-plugin": "0.79.7",
120
+ "@react-native/js-polyfills": "0.79.7",
121
+ "@react-native/normalize-colors": "0.79.7",
122
122
  "abort-controller": "^3.0.0",
123
123
  "anser": "^1.4.9",
124
124
  "ansi-regex": "^5.0.0",
@@ -147,7 +147,7 @@
147
147
  "whatwg-fetch": "^3.0.0",
148
148
  "ws": "^6.2.3",
149
149
  "yargs": "^17.6.2",
150
- "@react-native-tvos/virtualized-lists": "0.79.5-0"
150
+ "@react-native-tvos/virtualized-lists": "0.79.7-1"
151
151
  },
152
152
  "codegenConfig": {
153
153
  "libraries": [
@@ -225,7 +225,10 @@ def hermestag_file(react_native_path)
225
225
  end
226
226
 
227
227
  def release_tarball_url(version, build_type)
228
- maven_repo_url = "https://repo1.maven.org/maven2"
228
+ maven_repo_url =
229
+ ENV['ENTERPRISE_REPOSITORY'] != nil && ENV['ENTERPRISE_REPOSITORY'] != "" ?
230
+ ENV['ENTERPRISE_REPOSITORY'] :
231
+ "https://repo1.maven.org/maven2"
229
232
  namespace = "com/facebook/react"
230
233
  # Sample url from Maven:
231
234
  # 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