react-native-tvos 0.77.0-0rc5 → 0.77.2-0

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 (80) hide show
  1. package/Libraries/Components/TV/TVFocusGuideView.js +0 -1
  2. package/Libraries/Components/View/ViewPropTypes.d.ts +4 -2
  3. package/Libraries/Core/ReactNativeVersion.js +2 -2
  4. package/Libraries/Core/setUpDeveloperTools.js +2 -3
  5. package/Libraries/Image/Image.android.js +2 -0
  6. package/Libraries/Image/ImageViewNativeComponent.js +3 -4
  7. package/Libraries/Image/RCTImageLoader.mm +9 -1
  8. package/Libraries/Pressability/Pressability.js +2 -2
  9. package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +1 -1
  10. package/Libraries/Utilities/HMRClient.js +0 -28
  11. package/Libraries/Utilities/HMRClientProdShim.js +0 -1
  12. package/React/Base/RCTConvert.mm +3 -1
  13. package/React/Base/RCTVersion.m +2 -2
  14. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +85 -31
  15. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -7
  16. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +5 -2
  17. package/React/Views/RCTTVView.m +5 -2
  18. package/React/Views/ScrollView/RCTScrollView.m +63 -26
  19. package/ReactAndroid/api/ReactAndroid.api +3 -0
  20. package/ReactAndroid/cmake-utils/ReactNative-application.cmake +13 -3
  21. package/ReactAndroid/gradle.properties +3 -3
  22. package/ReactAndroid/src/main/AndroidManifest.xml +1 -1
  23. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +8 -0
  24. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +12 -1
  25. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +37 -0
  26. package/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java +6 -1
  27. package/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java +1 -1
  28. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java +7 -2
  29. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +8 -2
  30. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +15 -8
  31. package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.kt +6 -1
  32. package/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.kt +15 -4
  33. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
  34. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt +21 -41
  35. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt +0 -1
  36. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt +0 -1
  37. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java +0 -1
  38. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt +141 -158
  39. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/Drawable.kt +17 -0
  40. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/LayerDrawable.kt +19 -0
  41. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/OutlineDrawable.kt +0 -1
  42. package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt +1 -1
  43. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +22 -2
  44. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +10 -2
  45. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +36 -27
  46. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +3 -3
  47. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +16 -2
  48. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +38 -31
  49. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +4 -2
  50. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputLocalData.java +13 -2
  51. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +12 -2
  52. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.java +2 -1
  53. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +1 -0
  54. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +15 -0
  55. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  56. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +22 -4
  57. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h +5 -0
  58. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +51 -22
  59. package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +6 -0
  60. package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +2 -0
  61. package/ReactCommon/react/renderer/attributedstring/conversions.h +5 -0
  62. package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +12 -0
  63. package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +2 -3
  64. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +24 -3
  65. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +6 -46
  66. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +4 -5
  67. package/gradle/libs.versions.toml +1 -1
  68. package/package.json +15 -12
  69. package/react-native.config.js +11 -21
  70. package/scripts/codegen/generate-artifacts-executor.js +8 -4
  71. package/scripts/generate-codegen-artifacts.js +6 -1
  72. package/sdks/hermes-engine/hermes-utils.rb +2 -2
  73. package/sdks/hermesc/linux64-bin/hermesc +0 -0
  74. package/sdks/hermesc/osx-bin/hermes +0 -0
  75. package/sdks/hermesc/osx-bin/hermesc +0 -0
  76. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  77. package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
  78. package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
  79. package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
  80. package/src/private/featureflags/ReactNativeFeatureFlags.js +2 -2
@@ -52,8 +52,29 @@ BOOL RCTIsAttributedStringEffectivelySame(
52
52
  NSDictionary<NSAttributedStringKey, id> *insensitiveAttributes,
53
53
  const facebook::react::TextAttributes &baseTextAttributes);
54
54
 
55
- @interface RCTWeakEventEmitterWrapper : NSObject
56
- @property (nonatomic, assign) facebook::react::SharedEventEmitter eventEmitter;
57
- @end
55
+ static inline NSData *RCTWrapEventEmitter(const facebook::react::SharedEventEmitter &eventEmitter)
56
+ {
57
+ auto eventEmitterPtr = new std::weak_ptr<const facebook::react::EventEmitter>(eventEmitter);
58
+ return [[NSData alloc] initWithBytesNoCopy:eventEmitterPtr
59
+ length:sizeof(eventEmitterPtr)
60
+ deallocator:^(void *ptrToDelete, NSUInteger) {
61
+ delete (std::weak_ptr<facebook::react::EventEmitter> *)ptrToDelete;
62
+ }];
63
+ }
64
+
65
+ static inline facebook::react::SharedEventEmitter RCTUnwrapEventEmitter(NSData *data)
66
+ {
67
+ if (data.length == 0) {
68
+ return nullptr;
69
+ }
70
+
71
+ auto weakPtr = dynamic_cast<std::weak_ptr<const facebook::react::EventEmitter> *>(
72
+ (std::weak_ptr<const facebook::react::EventEmitter> *)data.bytes);
73
+ if (weakPtr) {
74
+ return weakPtr->lock();
75
+ }
76
+
77
+ return nullptr;
78
+ }
58
79
 
59
80
  NS_ASSUME_NONNULL_END
@@ -16,45 +16,6 @@
16
16
 
17
17
  using namespace facebook::react;
18
18
 
19
- @implementation RCTWeakEventEmitterWrapper {
20
- std::weak_ptr<const EventEmitter> _weakEventEmitter;
21
- }
22
-
23
- - (void)setEventEmitter:(SharedEventEmitter)eventEmitter
24
- {
25
- _weakEventEmitter = eventEmitter;
26
- }
27
-
28
- - (SharedEventEmitter)eventEmitter
29
- {
30
- return _weakEventEmitter.lock();
31
- }
32
-
33
- - (void)dealloc
34
- {
35
- _weakEventEmitter.reset();
36
- }
37
-
38
- - (BOOL)isEqual:(id)object
39
- {
40
- // We consider the underlying EventEmitter as the identity
41
- if (![object isKindOfClass:[self class]]) {
42
- return NO;
43
- }
44
-
45
- auto thisEventEmitter = [self eventEmitter];
46
- auto otherEventEmitter = [((RCTWeakEventEmitterWrapper *)object) eventEmitter];
47
- return thisEventEmitter == otherEventEmitter;
48
- }
49
-
50
- - (NSUInteger)hash
51
- {
52
- // We consider the underlying EventEmitter as the identity
53
- return (NSUInteger)_weakEventEmitter.lock().get();
54
- }
55
-
56
- @end
57
-
58
19
  inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight)
59
20
  {
60
21
  assert(fontWeight > 50);
@@ -139,6 +100,7 @@ inline static CGFloat RCTBaseSizeForDynamicTypeRamp(const DynamicTypeRamp &dynam
139
100
  inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const TextAttributes &textAttributes)
140
101
  {
141
102
  if (textAttributes.allowFontScaling.value_or(true)) {
103
+ CGFloat fontSizeMultiplier = !isnan(textAttributes.fontSizeMultiplier) ? textAttributes.fontSizeMultiplier : 1.0;
142
104
  if (textAttributes.dynamicTypeRamp.has_value()) {
143
105
  DynamicTypeRamp dynamicTypeRamp = textAttributes.dynamicTypeRamp.value();
144
106
  UIFontMetrics *fontMetrics =
@@ -146,10 +108,11 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
146
108
  // Using a specific font size reduces rounding errors from -scaledValueForValue:
147
109
  CGFloat requestedSize =
148
110
  isnan(textAttributes.fontSize) ? RCTBaseSizeForDynamicTypeRamp(dynamicTypeRamp) : textAttributes.fontSize;
149
- return [fontMetrics scaledValueForValue:requestedSize] / requestedSize;
150
- } else {
151
- return textAttributes.fontSizeMultiplier;
111
+ fontSizeMultiplier = [fontMetrics scaledValueForValue:requestedSize] / requestedSize;
152
112
  }
113
+ CGFloat maxFontSizeMultiplier =
114
+ !isnan(textAttributes.maxFontSizeMultiplier) ? textAttributes.maxFontSizeMultiplier : 0.0;
115
+ return maxFontSizeMultiplier >= 1.0 ? fminf(maxFontSizeMultiplier, fontSizeMultiplier) : fontSizeMultiplier;
153
116
  } else {
154
117
  return 1.0;
155
118
  }
@@ -407,10 +370,8 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
407
370
  {
408
371
  auto nsAttributedStringFragment = RCTNSAttributedStringFragmentFromFragment(fragment, placeholderImage);
409
372
 
410
- #if !TARGET_OS_MACCATALYST
411
373
  if (fragment.parentShadowView.componentHandle) {
412
- RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
413
- eventEmitterWrapper.eventEmitter = fragment.parentShadowView.eventEmitter;
374
+ auto eventEmitterWrapper = RCTWrapEventEmitter(fragment.parentShadowView.eventEmitter);
414
375
 
415
376
  NSDictionary<NSAttributedStringKey, id> *additionalTextAttributes =
416
377
  @{RCTAttributedStringEventEmitterKey : eventEmitterWrapper};
@@ -418,7 +379,6 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
418
379
  [nsAttributedStringFragment addAttributes:additionalTextAttributes
419
380
  range:NSMakeRange(0, nsAttributedStringFragment.length)];
420
381
  }
421
- #endif
422
382
 
423
383
  return nsAttributedStringFragment;
424
384
  }
@@ -280,11 +280,10 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
280
280
  // after (fraction == 1.0) the last character, then the attribute is valid.
281
281
  if (textStorage.length > 0 && (fraction > 0 || characterIndex > 0) &&
282
282
  (fraction < 1 || characterIndex < textStorage.length - 1)) {
283
- RCTWeakEventEmitterWrapper *eventEmitterWrapper =
284
- (RCTWeakEventEmitterWrapper *)[textStorage attribute:RCTAttributedStringEventEmitterKey
285
- atIndex:characterIndex
286
- effectiveRange:NULL];
287
- return eventEmitterWrapper.eventEmitter;
283
+ NSData *eventEmitterWrapper = (NSData *)[textStorage attribute:RCTAttributedStringEventEmitterKey
284
+ atIndex:characterIndex
285
+ effectiveRange:NULL];
286
+ return RCTUnwrapEventEmitter(eventEmitterWrapper);
288
287
  }
289
288
 
290
289
  return nil;
@@ -1,6 +1,6 @@
1
1
  [versions]
2
2
  # Android versions
3
- minSdk = "24"
3
+ minSdk = "22"
4
4
  targetSdk = "35"
5
5
  compileSdk = "35"
6
6
  buildTools = "35.0.0"
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.77.0-0rc5",
3
+ "version": "0.77.2-0",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/facebook/react-native.git",
8
+ "url": "git+https://github.com/react-native-tvos/react-native-tvos.git",
9
9
  "directory": "packages/react-native"
10
10
  },
11
- "homepage": "https://reactnative.dev/",
11
+ "homepage": "https://github.com/react-native-tvos/react-native-tvos/wiki",
12
12
  "keywords": [
13
13
  "react",
14
14
  "react-native",
15
15
  "android",
16
16
  "ios",
17
+ "tvos",
18
+ "apple tv",
19
+ "android tv",
17
20
  "mobile",
18
21
  "cross-platform",
19
22
  "app-framework",
@@ -109,13 +112,13 @@
109
112
  },
110
113
  "dependencies": {
111
114
  "@jest/create-cache-key-function": "^29.6.3",
112
- "@react-native/assets-registry": "0.77.0-rc.5",
113
- "@react-native/codegen": "0.77.0-rc.5",
114
- "@react-native/community-cli-plugin": "0.77.0-rc.5",
115
- "@react-native/gradle-plugin": "0.77.0-rc.5",
116
- "@react-native/js-polyfills": "0.77.0-rc.5",
117
- "@react-native/normalize-colors": "0.77.0-rc.5",
118
- "@react-native-tvos/virtualized-lists": "0.77.0-0rc5",
115
+ "@react-native/assets-registry": "0.77.2",
116
+ "@react-native/codegen": "0.77.2",
117
+ "@react-native/community-cli-plugin": "0.77.2",
118
+ "@react-native/gradle-plugin": "0.77.2",
119
+ "@react-native/js-polyfills": "0.77.2",
120
+ "@react-native/normalize-colors": "0.77.2",
121
+ "@react-native-tvos/virtualized-lists": "0.77.2-0",
119
122
  "abort-controller": "^3.0.0",
120
123
  "anser": "^1.4.9",
121
124
  "ansi-regex": "^5.0.0",
@@ -131,8 +134,8 @@
131
134
  "jest-environment-node": "^29.6.3",
132
135
  "jsc-android": "^250231.0.0",
133
136
  "memoize-one": "^5.0.0",
134
- "metro-runtime": "^0.81.0",
135
- "metro-source-map": "^0.81.0",
137
+ "metro-runtime": "^0.81.3",
138
+ "metro-source-map": "^0.81.3",
136
139
  "nullthrows": "^1.1.1",
137
140
  "pretty-format": "^29.7.0",
138
141
  "promise": "^8.3.0",
@@ -44,27 +44,11 @@ try {
44
44
 
45
45
  const commands = [];
46
46
 
47
- try {
48
- const {
49
- bundleCommand,
50
- startCommand,
51
- } = require('@react-native/community-cli-plugin');
52
- commands.push(bundleCommand, startCommand);
53
- } catch (e) {
54
- const known =
55
- e.code === 'MODULE_NOT_FOUND' &&
56
- e.message.includes('@react-native-community/cli-server-api');
57
-
58
- if (!known) {
59
- throw e;
60
- }
61
-
62
- if (verbose) {
63
- console.warn(
64
- '@react-native-community/cli-server-api not found, the react-native.config.js may be unusable.',
65
- );
66
- }
67
- }
47
+ const {
48
+ bundleCommand,
49
+ startCommand,
50
+ } = require('@react-native/community-cli-plugin');
51
+ commands.push(bundleCommand, startCommand);
68
52
 
69
53
  const codegenCommand = {
70
54
  name: 'codegen',
@@ -84,12 +68,18 @@ const codegenCommand = {
84
68
  name: '--outputPath <path>',
85
69
  description: 'Path where generated artifacts will be output to.',
86
70
  },
71
+ {
72
+ name: '--source <string>',
73
+ description: 'Whether the script is invoked from an `app` or a `library`',
74
+ default: 'app',
75
+ },
87
76
  ],
88
77
  func: (argv, config, args) =>
89
78
  require('./scripts/codegen/generate-artifacts-executor').execute(
90
79
  args.path,
91
80
  args.platform,
92
81
  args.outputPath,
82
+ args.source,
93
83
  ),
94
84
  };
95
85
 
@@ -900,11 +900,12 @@ function generateFBReactNativeSpecIOS(projectRoot /*: string */) /*: void*/ {
900
900
  * @parameter projectRoot: the directory with the app source code, where the package.json lives.
901
901
  * @parameter baseOutputPath: the base output path for the CodeGen.
902
902
  * @parameter targetPlatform: the target platform. Supported values: 'android', 'ios', 'all'.
903
+ * @parameter source: the source that is invoking codegen. Supported values: 'app', 'library'.
903
904
  * @throws If it can't find a config file for react-native.
904
905
  * @throws If it can't find a CodeGen configuration in the file.
905
906
  * @throws If it can't find a cli for the CodeGen.
906
907
  */
907
- function execute(projectRoot, targetPlatform, baseOutputPath) {
908
+ function execute(projectRoot, targetPlatform, baseOutputPath, source) {
908
909
  try {
909
910
  codegenLog(`Analyzing ${path.join(projectRoot, 'package.json')}`);
910
911
 
@@ -952,9 +953,12 @@ function execute(projectRoot, targetPlatform, baseOutputPath) {
952
953
  platform,
953
954
  );
954
955
 
955
- generateRCTThirdPartyComponents(libraries, outputPath);
956
- generateCustomURLHandlers(libraries, outputPath);
957
- generateAppDependencyProvider(outputPath);
956
+ if (source === 'app') {
957
+ // These components are only required by apps, not by libraries
958
+ generateRCTThirdPartyComponents(libraries, outputPath);
959
+ generateCustomURLHandlers(libraries, outputPath);
960
+ generateAppDependencyProvider(outputPath);
961
+ }
958
962
 
959
963
  cleanupEmptyFilesAndFolders(outputPath);
960
964
  }
@@ -25,7 +25,12 @@ const argv = yargs
25
25
  alias: 'outputPath',
26
26
  description: 'Path where generated artifacts will be output to.',
27
27
  })
28
+ .option('s', {
29
+ alias: 'source',
30
+ description: 'Whether the script is invoked from an `app` or a `library`',
31
+ default: 'app',
32
+ })
28
33
  .usage('Usage: $0 -p [path to app] -t [target platform] -o [output path]')
29
34
  .demandOption(['p', 't']).argv;
30
35
 
31
- executor.execute(argv.path, argv.targetPlatform, argv.outputPath);
36
+ executor.execute(argv.path, argv.targetPlatform, argv.outputPath, argv.source);
@@ -113,8 +113,8 @@ def core_version(version)
113
113
  prerelease = match[2]
114
114
  prerelease_match = prerelease.match(/0rc(\d+)/)
115
115
  if prerelease_match.nil?
116
- hermes_log("core_version = #{version}")
117
- return version
116
+ hermes_log("core_version = #{core_base_version}")
117
+ return core_base_version
118
118
  end
119
119
 
120
120
  cv = "#{core_base_version}-rc.#{prerelease_match[1]}"
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -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 SignedSource<<83b5798ee1c7a28fffbf110e19641d69>>
7
+ * @generated SignedSource<<aa51de14d1f085127ad410580beb15f6>>
8
8
  * @flow strict
9
9
  */
10
10
 
@@ -170,7 +170,7 @@ export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScript
170
170
  /**
171
171
  * Changes construction of the animation graph to `useInsertionEffect` instead of `useLayoutEffect`.
172
172
  */
173
- export const useInsertionEffectsForAnimations: Getter<boolean> = createJavaScriptFlagGetter('useInsertionEffectsForAnimations', true);
173
+ export const useInsertionEffectsForAnimations: Getter<boolean> = createJavaScriptFlagGetter('useInsertionEffectsForAnimations', false);
174
174
 
175
175
  /**
176
176
  * Enable a variant of TextInput that moves some state to refs to avoid unnecessary re-renders