react-native-tvos 0.73.0-0rc2 → 0.73.0-0rc3

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 (24) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.mm +2 -2
  2. package/Libraries/Components/TabBarIOS/RCTTabBarItemNativeComponent.js +1 -1
  3. package/Libraries/Components/TabBarIOS/RCTTabBarNativeComponent.js +1 -1
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/React/Base/RCTVersion.m +1 -1
  6. package/React/DevSupport/RCTInspectorDevServerHelper.mm +60 -4
  7. package/React/Views/SafeAreaView/RCTSafeAreaView.m +6 -1
  8. package/ReactAndroid/gradle.properties +1 -1
  9. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +1 -4
  10. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +70 -5
  11. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +2 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  13. package/ReactAndroid/src/main/jni/react/fabric/Binding.h +5 -1
  14. package/ReactAndroid/src/main/jni/react/fabric/JFabricUIManager.cpp +3 -2
  15. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  16. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +0 -1
  17. package/package.json +5 -5
  18. package/scripts/cocoapods/codegen.rb +5 -16
  19. package/scripts/cocoapods/codegen_utils.rb +1 -0
  20. package/sdks/hermesc/osx-bin/hermes +0 -0
  21. package/sdks/hermesc/osx-bin/hermesc +0 -0
  22. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  23. package/template/android/build.gradle +2 -2
  24. package/template/package.json +1 -1
@@ -23,7 +23,7 @@
23
23
  #import <React/RCTSurfaceHostingProxyRootView.h>
24
24
  #import <React/RCTSurfacePresenter.h>
25
25
  #import <ReactCommon/RCTContextContainerHandling.h>
26
- #if RCT_USE_HERMES
26
+ #if USE_HERMES
27
27
  #import <ReactCommon/RCTHermesInstance.h>
28
28
  #else
29
29
  #import <ReactCommon/RCTJscInstance.h>
@@ -295,7 +295,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
295
295
 
296
296
  - (std::shared_ptr<facebook::react::JSEngineInstance>)createJSEngineInstance
297
297
  {
298
- #if RCT_USE_HERMES
298
+ #if USE_HERMES
299
299
  return std::make_shared<facebook::react::RCTHermesInstance>(_reactNativeConfig, nullptr);
300
300
  #else
301
301
  return std::make_shared<facebook::react::RCTJscInstance>();
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
13
+ const requireNativeComponent = require('../../ReactNative/requireNativeComponent').default;
14
14
 
15
15
  import type {ViewProps} from '../View/ViewPropTypes';
16
16
  import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
13
+ const requireNativeComponent = require('../../ReactNative/requireNativeComponent').default;
14
14
 
15
15
  import type {ViewProps} from '../View/ViewPropTypes';
16
16
  import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
15
  patch: 0,
16
- prerelease: '0rc2',
16
+ prerelease: '0rc3',
17
17
  };
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"0rc2",
27
+ RCTVersionPrerelease: @"0rc3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -15,6 +15,8 @@
15
15
  #import <React/RCTDefines.h>
16
16
  #import <React/RCTInspectorPackagerConnection.h>
17
17
 
18
+ #import <CommonCrypto/CommonCrypto.h>
19
+
18
20
  static NSString *const kDebuggerMsgDisable = @"{ \"id\":1,\"method\":\"Debugger.disable\" }";
19
21
 
20
22
  static NSString *getServerHost(NSURL *bundleURL)
@@ -40,16 +42,65 @@ static NSString *getServerHost(NSURL *bundleURL)
40
42
  return [NSString stringWithFormat:@"%@:%@", host, port];
41
43
  }
42
44
 
45
+ static NSString *getSHA256(NSString *string)
46
+ {
47
+ const char *str = string.UTF8String;
48
+ unsigned char result[CC_SHA256_DIGEST_LENGTH];
49
+ CC_SHA256(str, (CC_LONG)strlen(str), result);
50
+
51
+ return [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
52
+ result[0],
53
+ result[1],
54
+ result[2],
55
+ result[3],
56
+ result[4],
57
+ result[5],
58
+ result[6],
59
+ result[7],
60
+ result[8],
61
+ result[9],
62
+ result[10],
63
+ result[11],
64
+ result[12],
65
+ result[13],
66
+ result[14],
67
+ result[15],
68
+ result[16],
69
+ result[17],
70
+ result[18],
71
+ result[19]];
72
+ }
73
+
74
+ // Returns an opaque ID which is stable for the current combination of device and app, stable across installs,
75
+ // and unique across devices.
76
+ static NSString *getInspectorDeviceId()
77
+ {
78
+ // A bundle ID uniquely identifies a single app throughout the system. [Source: Apple docs]
79
+ NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
80
+
81
+ // An alphanumeric string that uniquely identifies a device to the app's vendor. [Source: Apple docs]
82
+ NSString *identifierForVendor = [[UIDevice currentDevice] identifierForVendor].UUIDString;
83
+
84
+ NSString *rawDeviceId = [NSString stringWithFormat:@"apple-%@-%@", identifierForVendor, bundleId];
85
+
86
+ return getSHA256(rawDeviceId);
87
+ }
88
+
43
89
  static NSURL *getInspectorDeviceUrl(NSURL *bundleURL)
44
90
  {
45
91
  NSString *escapedDeviceName = [[[UIDevice currentDevice] name]
46
92
  stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
47
93
  NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier]
48
94
  stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
49
- return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@",
95
+
96
+ NSString *escapedInspectorDeviceId = [getInspectorDeviceId()
97
+ stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
98
+
99
+ return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@&device=%@",
50
100
  getServerHost(bundleURL),
51
101
  escapedDeviceName,
52
- escapedAppName]];
102
+ escapedAppName,
103
+ escapedInspectorDeviceId]];
53
104
  }
54
105
 
55
106
  @implementation RCTInspectorDevServerHelper
@@ -70,8 +121,13 @@ static void sendEventToAllConnections(NSString *event)
70
121
  NSString *appId = [[[NSBundle mainBundle] bundleIdentifier]
71
122
  stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
72
123
 
73
- NSURL *url = [NSURL
74
- URLWithString:[NSString stringWithFormat:@"http://%@/open-debugger?appId=%@", getServerHost(bundleURL), appId]];
124
+ NSString *escapedInspectorDeviceId = [getInspectorDeviceId()
125
+ stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
126
+
127
+ NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/open-debugger?appId=%@&device=%@",
128
+ getServerHost(bundleURL),
129
+ appId,
130
+ escapedInspectorDeviceId]];
75
131
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
76
132
  [request setHTTPMethod:@"POST"];
77
133
 
@@ -57,7 +57,12 @@ static BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIE
57
57
 
58
58
  - (void)setSafeAreaInsets:(UIEdgeInsets)safeAreaInsets
59
59
  {
60
- if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale())) {
60
+ // Relayout with different padding may result in a close but slightly different result, amplified by Yoga rounding to
61
+ // physical pixel grid. To avoid infinite relayout, allow one physical pixel of difference, along with small amount of
62
+ // extra tolerance for FP error.
63
+ CGFloat tolerance = 1.0 / RCTScreenScale() + 0.01;
64
+
65
+ if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, tolerance)) {
61
66
  return;
62
67
  }
63
68
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.0-0rc2
1
+ VERSION_NAME=0.73.0-0rc3
2
2
 
3
3
  # react.internal.publishingGroup=com.facebook.react
4
4
  # For TV use this group
@@ -1278,14 +1278,12 @@ public class ReactInstanceManager {
1278
1278
  uiManager.stopSurface(surfaceId);
1279
1279
  } else {
1280
1280
  FLog.w(ReactConstants.TAG, "Failed to stop surface, UIManager has already gone away");
1281
- reactRoot.getRootViewGroup().removeAllViews();
1282
1281
  }
1283
1282
  } else {
1284
1283
  ReactSoftExceptionLogger.logSoftException(
1285
1284
  TAG,
1286
1285
  new RuntimeException(
1287
1286
  "detachRootViewFromInstance called with ReactRootView with invalid id"));
1288
- reactRoot.getRootViewGroup().removeAllViews();
1289
1287
  }
1290
1288
  } else {
1291
1289
  reactContext
@@ -1294,8 +1292,7 @@ public class ReactInstanceManager {
1294
1292
  .unmountApplicationComponentAtRootTag(reactRoot.getRootViewTag());
1295
1293
  }
1296
1294
 
1297
- // The view is no longer attached, so mark it as such by resetting its ID.
1298
- reactRoot.getRootViewGroup().setId(View.NO_ID);
1295
+ clearReactRoot(reactRoot);
1299
1296
  }
1300
1297
 
1301
1298
  @ThreadConfined(UI)
@@ -9,6 +9,7 @@ package com.facebook.react.devsupport;
9
9
 
10
10
  import android.net.Uri;
11
11
  import android.os.AsyncTask;
12
+ import android.provider.Settings;
12
13
  import androidx.annotation.NonNull;
13
14
  import androidx.annotation.Nullable;
14
15
  import com.facebook.common.logging.FLog;
@@ -30,6 +31,9 @@ import com.facebook.react.packagerconnection.Responder;
30
31
  import com.facebook.react.util.RNLog;
31
32
  import java.io.File;
32
33
  import java.io.IOException;
34
+ import java.io.UnsupportedEncodingException;
35
+ import java.security.MessageDigest;
36
+ import java.security.NoSuchAlgorithmException;
33
37
  import java.util.HashMap;
34
38
  import java.util.Locale;
35
39
  import java.util.Map;
@@ -244,13 +248,73 @@ public class DevServerHelper {
244
248
  mPackagerConnectionSettings.getDebugServerHost());
245
249
  }
246
250
 
251
+ private static String getSHA256(String string) {
252
+ MessageDigest digest = null;
253
+ try {
254
+ digest = MessageDigest.getInstance("SHA-256");
255
+ } catch (NoSuchAlgorithmException e) {
256
+ throw new AssertionError("Could not get standard SHA-256 algorithm", e);
257
+ }
258
+ digest.reset();
259
+ byte[] result;
260
+ try {
261
+ result = digest.digest(string.getBytes("UTF-8"));
262
+ } catch (UnsupportedEncodingException e) {
263
+ throw new AssertionError("This environment doesn't support UTF-8 encoding", e);
264
+ }
265
+ return String.format(
266
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
267
+ result[0],
268
+ result[1],
269
+ result[2],
270
+ result[3],
271
+ result[4],
272
+ result[5],
273
+ result[6],
274
+ result[7],
275
+ result[8],
276
+ result[9],
277
+ result[10],
278
+ result[11],
279
+ result[12],
280
+ result[13],
281
+ result[14],
282
+ result[15],
283
+ result[16],
284
+ result[17],
285
+ result[18],
286
+ result[19]);
287
+ }
288
+
289
+ // Returns an opaque ID which is stable for the current combination of device and app, stable
290
+ // across installs, and unique across devices.
291
+ private String getInspectorDeviceId() {
292
+ // Every Android app has a unique application ID that looks like a Java or Kotlin package name,
293
+ // such as com.example.myapp. This ID uniquely identifies your app on the device and in the
294
+ // Google Play Store.
295
+ // [Source: Android docs]
296
+ String packageName = mPackageName;
297
+
298
+ // A 64-bit number expressed as a hexadecimal string, which is either:
299
+ // * unique to each combination of app-signing key, user, and device (API level >= 26), or
300
+ // * randomly generated when the user first sets up the device and should remain constant for
301
+ // the lifetime of the user's device (API level < 26).
302
+ // [Source: Android docs]
303
+ String androidId = Settings.Secure.ANDROID_ID;
304
+
305
+ String rawDeviceId = String.format(Locale.US, "android-%s-%s", packageName, androidId);
306
+
307
+ return getSHA256(rawDeviceId);
308
+ }
309
+
247
310
  private String getInspectorDeviceUrl() {
248
311
  return String.format(
249
312
  Locale.US,
250
- "http://%s/inspector/device?name=%s&app=%s",
313
+ "http://%s/inspector/device?name=%s&app=%s&device=%s",
251
314
  mPackagerConnectionSettings.getInspectorServerHost(),
252
- AndroidInfoHelpers.getFriendlyDeviceName(),
253
- mPackageName);
315
+ Uri.encode(AndroidInfoHelpers.getFriendlyDeviceName()),
316
+ Uri.encode(mPackageName),
317
+ Uri.encode(getInspectorDeviceId()));
254
318
  }
255
319
 
256
320
  public void downloadBundleFromURL(
@@ -425,9 +489,10 @@ public class DevServerHelper {
425
489
  String requestUrl =
426
490
  String.format(
427
491
  Locale.US,
428
- "http://%s/open-debugger?appId=%s",
492
+ "http://%s/open-debugger?appId=%s&device=%s",
429
493
  mPackagerConnectionSettings.getInspectorServerHost(),
430
- Uri.encode(mPackageName));
494
+ Uri.encode(mPackageName),
495
+ Uri.encode(getInspectorDeviceId()));
431
496
  Request request =
432
497
  new Request.Builder().url(requestUrl).method("POST", RequestBody.create(null, "")).build();
433
498
 
@@ -40,6 +40,7 @@ public class ReactAndroidHWInputDeviceHelper {
40
40
  .put(KeyEvent.KEYCODE_MEDIA_PREVIOUS, "previous")
41
41
  .put(KeyEvent.KEYCODE_MEDIA_REWIND, "rewind")
42
42
  .put(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, "fastForward")
43
+ .put(KeyEvent.KEYCODE_MEDIA_RECORD, "record")
43
44
  .put(KeyEvent.KEYCODE_MEDIA_STOP, "stop")
44
45
  .put(KeyEvent.KEYCODE_MEDIA_NEXT, "next")
45
46
  .put(KeyEvent.KEYCODE_MEDIA_PREVIOUS, "previous")
@@ -48,6 +49,7 @@ public class ReactAndroidHWInputDeviceHelper {
48
49
  .put(KeyEvent.KEYCODE_DPAD_DOWN, "down")
49
50
  .put(KeyEvent.KEYCODE_DPAD_LEFT, "left")
50
51
  .put(KeyEvent.KEYCODE_INFO, "info")
52
+ .put(KeyEvent.KEYCODE_CAPTIONS, "captions")
51
53
  .put(KeyEvent.KEYCODE_MENU, "menu")
52
54
  .put(KeyEvent.KEYCODE_0, "0")
53
55
  .put(KeyEvent.KEYCODE_1, "1")
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 73,
20
20
  "patch", 0,
21
- "prerelease", "0rc2");
21
+ "prerelease", "0rc3");
22
22
  }
@@ -34,7 +34,11 @@ class ReactNativeConfig;
34
34
  class Scheduler;
35
35
  class SurfaceHandlerBinding;
36
36
 
37
- class Binding : public jni::HybridClass<Binding>,
37
+ struct JBinding : public jni::JavaClass<JBinding> {
38
+ constexpr static auto kJavaDescriptor = "Lcom/facebook/react/fabric/Binding;";
39
+ };
40
+
41
+ class Binding : public jni::HybridClass<Binding, JBinding>,
38
42
  public SchedulerDelegate,
39
43
  public LayoutAnimationStatusDelegate {
40
44
  public:
@@ -13,8 +13,9 @@ namespace facebook::react {
13
13
 
14
14
  Binding* JFabricUIManager::getBinding() {
15
15
  static const auto bindingField =
16
- javaClassStatic()->getField<Binding::javaobject>("mBinding");
16
+ javaClassStatic()->getField<JBinding::javaobject>("mBinding");
17
17
 
18
- return getFieldValue(bindingField)->cthis();
18
+ return jni::static_ref_cast<Binding::javaobject>(getFieldValue(bindingField))
19
+ ->cthis();
19
20
  }
20
21
  } // namespace facebook::react
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 73;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "0rc2";
21
+ std::string_view Prerelease = "0rc3";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -56,7 +56,6 @@ Pod::Spec.new do |s|
56
56
 
57
57
  s.dependency "RCT-Folly/Fabric"
58
58
  s.dependency "React-Core/Default"
59
- s.dependency "React-RCTImage"
60
59
  s.dependency "glog"
61
60
 
62
61
  add_dependency(s, "React-Fabric")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.73.0-0rc2",
3
+ "version": "0.73.0-0rc3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -98,9 +98,9 @@
98
98
  "@react-native-community/cli-platform-android": "12.1.1",
99
99
  "@react-native-community/cli-platform-ios": "12.1.1",
100
100
  "@react-native/assets-registry": "^0.73.1",
101
- "@react-native/community-cli-plugin": "^0.73.9",
102
- "@react-native/codegen": "^0.73.1",
103
- "@react-native/gradle-plugin": "^0.73.3",
101
+ "@react-native/community-cli-plugin": "^0.73.10",
102
+ "@react-native/codegen": "^0.73.2",
103
+ "@react-native/gradle-plugin": "^0.73.4",
104
104
  "@react-native/js-polyfills": "^0.73.1",
105
105
  "@react-native/normalize-colors": "^0.73.2",
106
106
  "@react-native/virtualized-lists": "^0.73.3",
@@ -150,6 +150,6 @@
150
150
  ]
151
151
  },
152
152
  "devDependencies": {
153
- "react-native-core": "npm:react-native@0.73.0-rc.5"
153
+ "react-native-core": "npm:react-native@0.73.0-rc.6"
154
154
  }
155
155
  }
@@ -11,23 +11,12 @@
11
11
  # - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes.
12
12
  # @throws an error if it could not find the codegen folder.
13
13
  def build_codegen!(react_native_path, relative_installation_root, dir_manager: Dir)
14
- codegen_repo_path = "#{basePath(react_native_path, relative_installation_root)}/../react-native-codegen";
15
- codegen_npm_path = "#{basePath(react_native_path, relative_installation_root)}/../@react-native/codegen";
16
- codegen_cli_path = ""
14
+ codegen_repo_path = "#{basePath(react_native_path, relative_installation_root)}/../react-native-codegen"
15
+ return unless dir_manager.exist?(codegen_repo_path) && !dir_manager.exist?("#{codegen_repo_path}/lib")
17
16
 
18
- if dir_manager.exist?(codegen_repo_path)
19
- codegen_cli_path = codegen_repo_path
20
- elsif dir_manager.exist?(codegen_npm_path)
21
- codegen_cli_path = codegen_npm_path
22
- else
23
- raise "[codegen] Could not find react-native-codegen."
24
- end
25
-
26
- if !dir_manager.exist?("#{codegen_cli_path}/lib")
27
- Pod::UI.puts "[Codegen] building #{codegen_cli_path}."
28
- system("#{codegen_cli_path}/scripts/oss/build.sh")
29
- end
30
- end
17
+ Pod::UI.puts "[Codegen] building #{codegen_repo_path}"
18
+ system("#{codegen_repo_path}/scripts/oss/build.sh")
19
+ end
31
20
 
32
21
  # It generates an empty `ThirdPartyProvider`, required by Fabric to load the components
33
22
  #
@@ -144,6 +144,7 @@ class CodegenUtils
144
144
  'React-graphics': [],
145
145
  'React-rendererdebug': [],
146
146
  'React-Fabric': [],
147
+ 'React-FabricImage': [],
147
148
  'React-debug': [],
148
149
  'React-utils': [],
149
150
  });
Binary file
Binary file
Binary file
@@ -1,5 +1,3 @@
1
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
-
3
1
  buildscript {
4
2
  ext {
5
3
  buildToolsVersion = "34.0.0"
@@ -19,3 +17,5 @@ buildscript {
19
17
  classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
20
18
  }
21
19
  }
20
+
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "expo": "^49.0.7",
15
15
  "react": "18.2.0",
16
- "react-native": "npm:react-native-tvos@0.73.0-0rc2"
16
+ "react-native": "npm:react-native-tvos@0.73.0-0rc3"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@babel/core": "^7.20.0",