react-native-tvos 0.88.0-0 → 0.88.1-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 (43) hide show
  1. package/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +26 -1
  2. package/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h +1 -1
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/LogBox/LogBoxNotificationContainer.js +7 -1
  5. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +3 -3
  6. package/React/Base/RCTStatusBarAppearance.h +30 -0
  7. package/React/Base/RCTStatusBarAppearance.mm +66 -0
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/React/CoreModules/RCTStatusBarManager.mm +34 -9
  10. package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +13 -5
  11. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +30 -2
  12. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +9 -0
  13. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +8 -1
  14. package/ReactAndroid/gradle.properties +1 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt +4 -0
  17. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextDecorationStyle.kt +32 -4
  18. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +4 -0
  19. package/ReactApple/RCTSwiftUI/RCTSwiftUIContainerView.swift +4 -0
  20. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  21. package/ReactCommon/jsi/jsi/decorator.h +64 -0
  22. package/ReactCommon/jsi/jsi/jsi.cpp +2 -4
  23. package/ReactCommon/jsi/jsi/test/testlib.cpp +285 -8
  24. package/ReactCommon/jsi/jsi/test/testlib.h +1 -0
  25. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +2 -1
  26. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +6 -2
  27. package/ReactCommon/yoga/yoga/algorithm/PixelGrid.cpp +49 -19
  28. package/package.json +8 -8
  29. package/scripts/cocoapods/utils.rb +51 -0
  30. package/scripts/codegen/templates/Package.swift.spm-template +13 -2
  31. package/scripts/react_native_pods.rb +1 -0
  32. package/scripts/setup-apple-spm.js +10 -5
  33. package/scripts/spm/autolinking-plugins.js +2 -1
  34. package/scripts/spm/flavored-frameworks.js +1 -0
  35. package/scripts/spm/generate-spm-autolinking.js +34 -96
  36. package/scripts/spm/generate-spm-xcodeproj.js +798 -285
  37. package/scripts/spm/ios-deployment-target.js +16 -63
  38. package/scripts/spm/spm-pbxproj.js +8 -3
  39. package/scripts/spm/spm-types.js +2 -15
  40. package/scripts/spm/sync-spm-autolinking.js +57 -23
  41. package/scripts/spm/xcconfig-files.js +149 -0
  42. package/sdks/.hermesv1version +1 -1
  43. package/sdks/hermes-engine/version.properties +1 -1
@@ -14,9 +14,34 @@
14
14
  #endif
15
15
 
16
16
  #import <RCTAnimatedModuleProvider/RCTAnimatedModuleProvider.h>
17
+ #import <React/RCTStatusBarAppearance.h>
17
18
  #import <react/featureflags/ReactNativeFeatureFlags.h>
18
19
  #import <react/nativemodule/defaults/DefaultTurboModules.h>
19
20
 
21
+ @interface RCTRootViewController : UIViewController
22
+ @end
23
+
24
+ @implementation RCTRootViewController
25
+
26
+ #if !TARGET_OS_TV
27
+ - (UIStatusBarStyle)preferredStatusBarStyle
28
+ {
29
+ return RCTStatusBarAppearance.style;
30
+ }
31
+
32
+ - (BOOL)prefersStatusBarHidden
33
+ {
34
+ return RCTStatusBarAppearance.hidden;
35
+ }
36
+
37
+ - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
38
+ {
39
+ return RCTStatusBarAppearance.updateAnimation;
40
+ }
41
+ #endif
42
+
43
+ @end
44
+
20
45
  @implementation RCTDefaultReactNativeFactoryDelegate {
21
46
  // C++ Native Animated provider, created once on first use (getTurboModule: may be called
22
47
  // concurrently for different module names).
@@ -35,7 +60,7 @@
35
60
 
36
61
  - (UIViewController *)createRootViewController
37
62
  {
38
- return [UIViewController new];
63
+ return [RCTRootViewController new];
39
64
  }
40
65
 
41
66
  - (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController
@@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
41
41
 
42
42
  /**
43
43
  * It creates the RootViewController.
44
- * By default, it creates a new instance of a `UIViewController`.
44
+ * By default, it creates a view controller that returns the `RCTStatusBarAppearance` values.
45
45
  * You can override it to provide your own initial ViewController.
46
46
  *
47
47
  * @return: an instance of `UIViewController`.
@@ -28,7 +28,7 @@
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 88;
31
- static patch: number = 0;
31
+ static patch: number = 1;
32
32
  static prerelease: string | null = '0';
33
33
 
34
34
  static getVersionString(): string {
@@ -112,9 +112,13 @@ export function LogBoxNotificationContainer(props: Props): React.Node {
112
112
 
113
113
  const styles = StyleSheet.create({
114
114
  list: {
115
+ alignItems: 'center',
115
116
  bottom: 20,
116
117
  left: 10,
117
118
  right: 10,
119
+ // The container spans the width of the screen, so it passes touches outside the toasts through to the app, such
120
+ // as to a tab bar beside them.
121
+ pointerEvents: 'box-none',
118
122
  position: 'absolute',
119
123
  },
120
124
  tvlist: {
@@ -124,9 +128,11 @@ const styles = StyleSheet.create({
124
128
  position: 'absolute',
125
129
  },
126
130
  toast: {
127
- borderRadius: 8,
131
+ borderRadius: 12,
128
132
  marginBottom: 5,
133
+ maxWidth: 600,
129
134
  overflow: 'hidden',
135
+ width: '100%',
130
136
  },
131
137
  });
132
138
 
@@ -24,8 +24,8 @@ export default function LogBoxNotificationDismissButton(props: {
24
24
  <LogBoxButton
25
25
  id={props.id}
26
26
  backgroundColor={{
27
- default: LogBoxStyle.getTextColor(0.3),
28
- pressed: LogBoxStyle.getTextColor(0.5),
27
+ default: LogBoxStyle.getTextColor(0.15),
28
+ pressed: LogBoxStyle.getTextColor(0.3),
29
29
  }}
30
30
  hitSlop={{
31
31
  top: 12,
@@ -64,6 +64,6 @@ const styles = StyleSheet.create({
64
64
  image: {
65
65
  height: 8,
66
66
  width: 8,
67
- tintColor: LogBoxStyle.getBackgroundColor(1),
67
+ tintColor: LogBoxStyle.getTextColor(0.8),
68
68
  },
69
69
  });
@@ -0,0 +1,30 @@
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
+ #import <UIKit/UIKit.h>
9
+
10
+ #if !TARGET_OS_TV
11
+
12
+ NS_ASSUME_NONNULL_BEGIN
13
+
14
+ /**
15
+ * The status bar state set from JavaScript. Root view controllers return these values from their status bar methods.
16
+ */
17
+ @interface RCTStatusBarAppearance : NSObject
18
+
19
+ @property (class, nonatomic, readonly) UIStatusBarStyle style;
20
+ @property (class, nonatomic, readonly) BOOL hidden;
21
+ @property (class, nonatomic, readonly) UIStatusBarAnimation updateAnimation;
22
+
23
+ + (void)setStyle:(UIStatusBarStyle)style animated:(BOOL)animated;
24
+ + (void)setHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation;
25
+
26
+ @end
27
+
28
+ NS_ASSUME_NONNULL_END
29
+
30
+ #endif // !TARGET_OS_TV
@@ -0,0 +1,66 @@
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
+ #import "RCTStatusBarAppearance.h"
9
+
10
+ #import "RCTAssert.h"
11
+ #import "RCTUtils.h"
12
+
13
+ #if !TARGET_OS_TV
14
+
15
+ static UIStatusBarStyle sStyle = UIStatusBarStyleDefault;
16
+ static BOOL sHidden = NO;
17
+ static UIStatusBarAnimation sUpdateAnimation = UIStatusBarAnimationNone;
18
+
19
+ @implementation RCTStatusBarAppearance
20
+
21
+ + (UIStatusBarStyle)style
22
+ {
23
+ return sStyle;
24
+ }
25
+
26
+ + (BOOL)hidden
27
+ {
28
+ return sHidden;
29
+ }
30
+
31
+ + (UIStatusBarAnimation)updateAnimation
32
+ {
33
+ return sUpdateAnimation;
34
+ }
35
+
36
+ + (void)setStyle:(UIStatusBarStyle)style animated:(BOOL)animated
37
+ {
38
+ RCTAssertMainQueue();
39
+ sStyle = style;
40
+ [self updateStatusBarAnimated:animated];
41
+ }
42
+
43
+ + (void)setHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation
44
+ {
45
+ RCTAssertMainQueue();
46
+ sHidden = hidden;
47
+ sUpdateAnimation = animation;
48
+ [self updateStatusBarAnimated:animation != UIStatusBarAnimationNone];
49
+ }
50
+
51
+ + (void)updateStatusBarAnimated:(BOOL)animated
52
+ {
53
+ UIViewController *viewController = RCTPresentedViewController();
54
+ if (animated) {
55
+ [UIView animateWithDuration:UINavigationControllerHideShowBarDuration
56
+ animations:^{
57
+ [viewController setNeedsStatusBarAppearanceUpdate];
58
+ }];
59
+ } else {
60
+ [viewController setNeedsStatusBarAppearanceUpdate];
61
+ }
62
+ }
63
+
64
+ @end
65
+
66
+ #endif // !TARGET_OS_TV
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(88),
26
- RCTVersionPatch: @(0),
26
+ RCTVersionPatch: @(1),
27
27
  RCTVersionPrerelease: @"0",
28
28
  };
29
29
  });
@@ -11,6 +11,7 @@
11
11
  #import <React/RCTEventDispatcherProtocol.h>
12
12
  #import <React/RCTInitializing.h>
13
13
  #import <React/RCTLog.h>
14
+ #import <React/RCTStatusBarAppearance.h>
14
15
  #import <React/RCTUtils.h>
15
16
 
16
17
  #if !TARGET_OS_TV
@@ -76,6 +77,28 @@ static BOOL RCTViewControllerBasedStatusBarAppearance()
76
77
  return value;
77
78
  }
78
79
 
80
+ // UIKit makes the app-level setters no-ops only for apps built with the iOS 27 SDK.
81
+ static BOOL RCTAppLevelStatusBarIsNoOp()
82
+ {
83
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 270000
84
+ if (@available(iOS 27.0, *)) {
85
+ return YES;
86
+ }
87
+ #endif
88
+ return NO;
89
+ }
90
+
91
+ static void RCTWarnAppLevelStatusBarUnavailable()
92
+ {
93
+ static dispatch_once_t onceToken;
94
+ dispatch_once(&onceToken, ^{
95
+ RCTLogWarn(
96
+ @"StatusBar has no effect because UIViewControllerBasedStatusBarAppearance is NO in Info.plist. "
97
+ @"Apps built with the iOS 27 SDK cannot use the app-level status bar API that this setting uses. "
98
+ @"Set UIViewControllerBasedStatusBarAppearance to YES to control the status bar from JavaScript.");
99
+ });
100
+ }
101
+
79
102
  RCT_EXPORT_MODULE()
80
103
 
81
104
  + (BOOL)requiresMainQueueSetup
@@ -172,15 +195,16 @@ RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback)
172
195
  {
173
196
  dispatch_async(dispatch_get_main_queue(), ^{
174
197
  UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style];
175
- if (RCTViewControllerBasedStatusBarAppearance()) {
176
- RCTLogWarn(@"RCTStatusBarManager is a no-op when \
177
- UIViewControllerBasedStatusBarAppearance is YES; set the status bar from your view controller instead");
178
- } else {
198
+ [RCTStatusBarAppearance setStyle:statusBarStyle animated:animated];
199
+ if (!RCTViewControllerBasedStatusBarAppearance()) {
179
200
  #pragma clang diagnostic push
180
201
  #pragma clang diagnostic ignored "-Wdeprecated-declarations"
181
202
  [RCTSharedApplication() setStatusBarStyle:statusBarStyle animated:animated];
182
- }
183
203
  #pragma clang diagnostic pop
204
+ if (RCTAppLevelStatusBarIsNoOp()) {
205
+ RCTWarnAppLevelStatusBarUnavailable();
206
+ }
207
+ }
184
208
  });
185
209
  }
186
210
 
@@ -188,14 +212,15 @@ RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback)
188
212
  {
189
213
  dispatch_async(dispatch_get_main_queue(), ^{
190
214
  UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];
191
- if (RCTViewControllerBasedStatusBarAppearance()) {
192
- RCTLogWarn(@"RCTStatusBarManager is a no-op when \
193
- UIViewControllerBasedStatusBarAppearance is YES; set the status bar from your view controller instead");
194
- } else {
215
+ [RCTStatusBarAppearance setHidden:hidden withAnimation:animation];
216
+ if (!RCTViewControllerBasedStatusBarAppearance()) {
195
217
  #pragma clang diagnostic push
196
218
  #pragma clang diagnostic ignored "-Wdeprecated-declarations"
197
219
  [RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
198
220
  #pragma clang diagnostic pop
221
+ if (RCTAppLevelStatusBarIsNoOp()) {
222
+ RCTWarnAppLevelStatusBarUnavailable();
223
+ }
199
224
  }
200
225
  });
201
226
  }
@@ -38,8 +38,6 @@ using namespace facebook::react;
38
38
  _imageView.layer.minificationFilter = kCAFilterTrilinear;
39
39
  _imageView.layer.magnificationFilter = kCAFilterTrilinear;
40
40
 
41
- _imageResponseObserverProxy = std::make_shared<RCTImageResponseObserverProxy>(self);
42
-
43
41
  self.contentView = _imageView;
44
42
  }
45
43
 
@@ -120,6 +118,11 @@ using namespace facebook::react;
120
118
  _state = state;
121
119
 
122
120
  if (_state) {
121
+ // A new observer per subscription: callbacks of a previous request can still be queued on the
122
+ // main queue (e.g. after this view was recycled and reused), and must not be applied here.
123
+ // The callbacks are matched by the proxy's address. The new proxy is allocated before the
124
+ // previous one is released, so two consecutive subscriptions never share an address.
125
+ _imageResponseObserverProxy = std::make_shared<RCTImageResponseObserverProxy>(self);
123
126
  auto &observerCoordinator = _state->getData().getImageRequest().getObserverCoordinator();
124
127
  observerCoordinator.addObserver(_imageResponseObserverProxy);
125
128
  }
@@ -136,8 +139,9 @@ using namespace facebook::react;
136
139
 
137
140
  - (void)didReceiveImage:(UIImage *)image metadata:(id)metadata fromObserver:(const void *)observer
138
141
  {
139
- if (!_eventEmitter || !_state) {
140
- // Notifications are delivered asynchronously and might arrive after the view is already recycled.
142
+ if (!_eventEmitter || !_state || observer != _imageResponseObserverProxy.get()) {
143
+ // Notifications are delivered asynchronously and might arrive after the view is already recycled,
144
+ // or after it has been reused for another image.
141
145
  // In the future, we should incorporate an `EventEmitter` into a separate object owned by `ImageRequest` or `State`.
142
146
  // See for more info: T46311063.
143
147
  return;
@@ -183,7 +187,7 @@ using namespace facebook::react;
183
187
  total:(int64_t)total
184
188
  fromObserver:(const void *)observer
185
189
  {
186
- if (!_eventEmitter) {
190
+ if (!_eventEmitter || observer != _imageResponseObserverProxy.get()) {
187
191
  return;
188
192
  }
189
193
 
@@ -192,6 +196,10 @@ using namespace facebook::react;
192
196
 
193
197
  - (void)didReceiveFailure:(NSError *)error fromObserver:(const void *)observer
194
198
  {
199
+ if (observer != _imageResponseObserverProxy.get()) {
200
+ return;
201
+ }
202
+
195
203
  _imageView.image = nil;
196
204
 
197
205
  if (!_eventEmitter) {
@@ -8,12 +8,18 @@
8
8
  #import "RCTFabricModalHostViewController.h"
9
9
 
10
10
  #import <React/RCTLog.h>
11
+ #import <React/RCTStatusBarAppearance.h>
11
12
  #import <React/RCTSurfaceTouchHandler.h>
12
13
 
13
14
  @implementation RCTFabricModalHostViewController {
14
15
  CGRect _lastViewBounds;
15
16
  #if !TARGET_OS_TV
16
17
  RCTSurfaceTouchHandler *_touchHandler;
18
+ BOOL _hasCapturedStatusBar;
19
+ UIStatusBarStyle _capturedStatusBarStyle;
20
+ BOOL _capturedStatusBarHidden;
21
+ UIStatusBarStyle _jsStatusBarStyleAtCapture;
22
+ BOOL _jsStatusBarHiddenAtCapture;
17
23
  #endif
18
24
  }
19
25
 
@@ -63,14 +69,36 @@
63
69
  [self.delegate disableEventHandlers];
64
70
  }
65
71
  #else
72
+ - (void)captureStatusBarAppearance
73
+ {
74
+ UIStatusBarManager *statusBarManager = RCTUIStatusBarManager();
75
+ _hasCapturedStatusBar = YES;
76
+ _capturedStatusBarStyle = statusBarManager.statusBarStyle;
77
+ _capturedStatusBarHidden = statusBarManager.isStatusBarHidden;
78
+ _jsStatusBarStyleAtCapture = RCTStatusBarAppearance.style;
79
+ _jsStatusBarHiddenAtCapture = RCTStatusBarAppearance.hidden;
80
+ }
81
+
82
+ // Keep the status bar from before the modal until JS changes it.
66
83
  - (UIStatusBarStyle)preferredStatusBarStyle
67
84
  {
68
- return [RCTUIStatusBarManager() statusBarStyle];
85
+ if (_hasCapturedStatusBar && RCTStatusBarAppearance.style == _jsStatusBarStyleAtCapture) {
86
+ return _capturedStatusBarStyle;
87
+ }
88
+ return RCTStatusBarAppearance.style;
69
89
  }
70
90
 
71
91
  - (BOOL)prefersStatusBarHidden
72
92
  {
73
- return [RCTUIStatusBarManager() isStatusBarHidden];
93
+ if (_hasCapturedStatusBar && RCTStatusBarAppearance.hidden == _jsStatusBarHiddenAtCapture) {
94
+ return _capturedStatusBarHidden;
95
+ }
96
+ return RCTStatusBarAppearance.hidden;
97
+ }
98
+
99
+ - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
100
+ {
101
+ return RCTStatusBarAppearance.updateAnimation;
74
102
  }
75
103
 
76
104
  #if RCT_DEV && TARGET_OS_IOS
@@ -22,6 +22,12 @@
22
22
  #import <React/RCTTVRemoteHandler.h>
23
23
  #endif
24
24
 
25
+ #if !TARGET_OS_TV
26
+ @interface RCTFabricModalHostViewController ()
27
+ - (void)captureStatusBarAppearance;
28
+ @end
29
+ #endif
30
+
25
31
  using namespace facebook::react;
26
32
 
27
33
  #if !TARGET_OS_TV
@@ -214,6 +220,9 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
214
220
  [self saveAccessibilityFocusedView];
215
221
  self.viewController.presentationController.delegate = self;
216
222
  self.viewController.modalInPresentation = _modalInPresentation;
223
+ #if !TARGET_OS_TV
224
+ [self.viewController captureStatusBarAppearance];
225
+ #endif
217
226
 
218
227
  _isPresented = YES;
219
228
  [self presentViewController:self.viewController
@@ -2424,7 +2424,13 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
2424
2424
 
2425
2425
  - (BOOL)styleNeedsSwiftUIContainer
2426
2426
  {
2427
- if (!_props->filter.empty()) {
2427
+ if (_props->filter.empty()) {
2428
+ return NO;
2429
+ }
2430
+
2431
+ // A filter must not affect layout, but UIHostingController insets its content by the safe area.
2432
+ // To disable the insets we use `safeAreaRegions` which is only available in iOS 16.4 and tvOS 16.4.
2433
+ if (@available(iOS 16.4, tvOS 16.4, *)) {
2428
2434
  for (const auto &primitive : _props->filter) {
2429
2435
  if (primitive.type == FilterType::Blur || primitive.type == FilterType::Grayscale ||
2430
2436
  primitive.type == FilterType::DropShadow || primitive.type == FilterType::Saturate ||
@@ -2433,6 +2439,7 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
2433
2439
  }
2434
2440
  }
2435
2441
  }
2442
+
2436
2443
  return NO;
2437
2444
  }
2438
2445
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.88.0-0
1
+ VERSION_NAME=0.88.1-0
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
  react.internal.hermesPublishingGroup=com.facebook.hermes
4
4
 
@@ -14,7 +14,7 @@ public object ReactNativeVersion {
14
14
  public val VERSION: Map<String, Any?> = mapOf(
15
15
  "major" to 0,
16
16
  "minor" to 88,
17
- "patch" to 0,
17
+ "patch" to 1,
18
18
  "prerelease" to "0"
19
19
  )
20
20
  }
@@ -179,6 +179,10 @@ public object ReactTypefaceUtils {
179
179
  }
180
180
 
181
181
  try {
182
+ // Paint skips unchanged settings even after setTypeface, so clear them first.
183
+ if (paint.fontVariationSettings != null && fontVariationSettings != null) {
184
+ paint.setFontVariationSettings(null)
185
+ }
182
186
  paint.setFontVariationSettings(fontVariationSettings)
183
187
  } catch (exception: IllegalArgumentException) {
184
188
  // Paint instances are reused, so explicitly clear axes from a previous layout.
@@ -111,6 +111,26 @@ private fun drawDecorationLine(
111
111
  }
112
112
  }
113
113
 
114
+ /**
115
+ * The last offset [layout] can resolve a horizontal position for. Truncation (via `numberOfLines`)
116
+ * can leave the last line shorter than [Layout.getLineEnd] reports, since [layout] keeps the full
117
+ * untruncated text and only clips how much of it is laid out. When the last line ends in a tail
118
+ * ellipsis, anything from the ellipsis onward is unresolvable too; a leading/middle ellipsis
119
+ * doesn't shorten what's resolvable on that line, so it's left to [Layout.getLineEnd].
120
+ */
121
+ private fun visibleTextEnd(layout: Layout): Int {
122
+ val lastLine = layout.lineCount - 1
123
+ val lineStart = layout.getLineStart(lastLine)
124
+ val lineEnd = layout.getLineEnd(lastLine)
125
+ val ellipsisStart = layout.getEllipsisStart(lastLine)
126
+ val ellipsisCount = layout.getEllipsisCount(lastLine)
127
+ return if (ellipsisCount > 0 && ellipsisStart + ellipsisCount == lineEnd - lineStart) {
128
+ lineStart + ellipsisStart
129
+ } else {
130
+ lineEnd
131
+ }
132
+ }
133
+
114
134
  /**
115
135
  * Shared decoration drawing entry point used by [ReactUnderlineSpan] and [ReactStrikethroughSpan].
116
136
  * Computes a density-aware stroke thickness, sets up a dedicated paint (to avoid mutating the
@@ -128,6 +148,12 @@ internal fun drawSpannedDecoration(
128
148
  style: TextDecorationStyle,
129
149
  yOffsetForLine: (paint: Paint, baseline: Float, thickness: Float) -> Float,
130
150
  ) {
151
+ if (layout.lineCount == 0) return
152
+ val visibleEnd = visibleTextEnd(layout)
153
+ val clampedStart = min(start, visibleEnd)
154
+ val clampedEnd = min(end, visibleEnd)
155
+ if (clampedStart >= clampedEnd) return
156
+
131
157
  val textPaint = layout.paint
132
158
  val effectiveColor =
133
159
  if (color != Color.TRANSPARENT) {
@@ -174,13 +200,15 @@ internal fun drawSpannedDecoration(
174
200
  }
175
201
  }
176
202
 
177
- val startLine = layout.getLineForOffset(start)
178
- val endLine = layout.getLineForOffset(end)
203
+ val startLine = layout.getLineForOffset(clampedStart)
204
+ val endLine = layout.getLineForOffset(clampedEnd)
179
205
  for (line in startLine..endLine) {
180
206
  val baseline = layout.getLineBaseline(line).toFloat()
181
207
  val rawX1 =
182
- if (line == startLine) layout.getPrimaryHorizontal(start) else layout.getLineLeft(line)
183
- val rawX2 = if (line == endLine) layout.getPrimaryHorizontal(end) else layout.getLineRight(line)
208
+ if (line == startLine) layout.getPrimaryHorizontal(clampedStart)
209
+ else layout.getLineLeft(line)
210
+ val rawX2 =
211
+ if (line == endLine) layout.getPrimaryHorizontal(clampedEnd) else layout.getLineRight(line)
184
212
  // Normalize for RTL text where start may be to the right of end.
185
213
  val x1 = min(rawX1, rawX2)
186
214
  val x2 = max(rawX1, rawX2)
@@ -724,6 +724,10 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
724
724
  val newTypeface = applyStyles(typeface, fontStyle, fontWeight, fontFamily, context.assets)
725
725
  typeface = newTypeface
726
726
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
727
+ // TextView skips unchanged settings even after a typeface change, so clear them first.
728
+ if (getFontVariationSettings() != null && parsedFontVariationSettings != null) {
729
+ super.setFontVariationSettings(null)
730
+ }
727
731
  super.setFontVariationSettings(parsedFontVariationSettings)
728
732
  }
729
733
 
@@ -15,6 +15,10 @@ import UIKit
15
15
  @objc public override init() {
16
16
  super.init()
17
17
  hostingController = UIHostingController(rootView: SwiftUIContainerView(viewModel: containerViewModel))
18
+ if #available(iOS 16.4, tvOS 16.4, *) {
19
+ // Disable implicit safe area insets or else the view is shifted by the safe area insets
20
+ hostingController?.safeAreaRegions = []
21
+ }
18
22
  guard let view = hostingController?.view else {
19
23
  return
20
24
  }
@@ -14,14 +14,14 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 88
17
- #define REACT_NATIVE_VERSION_PATCH 0
17
+ #define REACT_NATIVE_VERSION_PATCH 1
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  struct ReactNativeVersionType {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 88;
24
- int32_t Patch = 0;
24
+ int32_t Patch = 1;
25
25
  std::string_view Prerelease = "0";
26
26
  };
27
27