react-native-tvos 0.88.0-0rc2 → 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 (75) hide show
  1. package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
  2. package/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +26 -1
  3. package/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h +1 -1
  4. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -5
  5. package/Libraries/Components/Button.js +4 -2
  6. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  7. package/Libraries/Components/Pressable/Pressable.js +4 -2
  8. package/Libraries/Components/TextInput/InputAccessoryView.js +8 -6
  9. package/Libraries/Components/TextInput/TextInput.js +5 -5
  10. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +85 -84
  11. package/Libraries/Components/View/ViewAccessibility.js +8 -4
  12. package/Libraries/Core/ReactNativeVersion.js +2 -2
  13. package/Libraries/Image/ImageProps.js +38 -18
  14. package/Libraries/LogBox/LogBoxNotificationContainer.js +7 -1
  15. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +3 -3
  16. package/Libraries/Modal/Modal.js +4 -2
  17. package/Libraries/StyleSheet/StyleSheet.js +3 -9
  18. package/Libraries/StyleSheet/StyleSheet.js.flow +3 -9
  19. package/Libraries/StyleSheet/StyleSheetTypes.js +12 -9
  20. package/Libraries/StyleSheet/splitLayoutProps.js +6 -6
  21. package/Libraries/Text/Text.js +6 -6
  22. package/React/Base/RCTStatusBarAppearance.h +30 -0
  23. package/React/Base/RCTStatusBarAppearance.mm +66 -0
  24. package/React/Base/RCTVersion.m +2 -2
  25. package/React/CoreModules/RCTStatusBarManager.mm +34 -9
  26. package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +13 -5
  27. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +30 -2
  28. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +9 -0
  29. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +8 -1
  30. package/ReactAndroid/gradle.properties +1 -1
  31. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
  32. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +16 -2
  33. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt +4 -0
  34. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextDecorationStyle.kt +32 -4
  35. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +4 -0
  36. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +17 -12
  37. package/ReactAndroid/src/main/res/views/uimanager/values/ids.xml +3 -0
  38. package/ReactApple/RCTSwiftUI/RCTSwiftUIContainerView.swift +4 -0
  39. package/ReactCommon/cxxreact/ReactNativeVersion.h +3 -3
  40. package/ReactCommon/jsi/jsi/decorator.h +64 -0
  41. package/ReactCommon/jsi/jsi/jsi.cpp +2 -4
  42. package/ReactCommon/jsi/jsi/test/testlib.cpp +285 -8
  43. package/ReactCommon/jsi/jsi/test/testlib.h +1 -0
  44. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +2 -1
  45. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +6 -2
  46. package/ReactCommon/yoga/yoga/algorithm/PixelGrid.cpp +49 -19
  47. package/package.json +8 -8
  48. package/scripts/cocoapods/utils.rb +51 -0
  49. package/scripts/codegen/templates/Package.swift.spm-template +13 -2
  50. package/scripts/react_native_pods.rb +1 -0
  51. package/scripts/setup-apple-spm.js +10 -5
  52. package/scripts/spm/autolinking-plugins.js +2 -1
  53. package/scripts/spm/flavored-frameworks.js +1 -0
  54. package/scripts/spm/generate-spm-autolinking.js +34 -96
  55. package/scripts/spm/generate-spm-xcodeproj.js +798 -285
  56. package/scripts/spm/ios-deployment-target.js +16 -63
  57. package/scripts/spm/spm-pbxproj.js +8 -3
  58. package/scripts/spm/spm-types.js +2 -15
  59. package/scripts/spm/sync-spm-autolinking.js +57 -23
  60. package/scripts/spm/xcconfig-files.js +149 -0
  61. package/sdks/.hermesv1version +1 -1
  62. package/sdks/hermes-engine/version.properties +1 -1
  63. package/types_DEPRECATED/index.d.ts +1 -0
  64. package/types_DEPRECATED/src/private/assets/AssetRegistry.d.ts +44 -0
  65. package/types_generated/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +7 -6
  66. package/types_generated/Libraries/Components/Button.d.ts +30 -29
  67. package/types_generated/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts +8 -7
  68. package/types_generated/Libraries/Components/Pressable/Pressable.d.ts +6 -5
  69. package/types_generated/Libraries/Components/TextInput/InputAccessoryView.d.ts +7 -6
  70. package/types_generated/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +26 -25
  71. package/types_generated/Libraries/Components/View/ViewAccessibility.d.ts +23 -22
  72. package/types_generated/Libraries/Image/ImageProps.d.ts +39 -36
  73. package/types_generated/Libraries/Modal/Modal.d.ts +4 -3
  74. package/types_generated/Libraries/StyleSheet/StyleSheet.d.ts +5 -8
  75. package/types_generated/Libraries/StyleSheet/StyleSheetTypes.d.ts +10 -10
@@ -910,7 +910,8 @@ export type ____ViewStyle_InternalCore = Readonly<{
910
910
  ...____ViewStyle_InternalBase,
911
911
  }>;
912
912
 
913
- export type ____ViewStyle_Internal = Readonly<{
913
+ /** @build-types emit-as-interface react-native-web compatibility */
914
+ export type ViewStyle = Readonly<{
914
915
  ...____ViewStyle_InternalCore,
915
916
  ...____ViewStyle_InternalOverrides,
916
917
  }>;
@@ -1047,17 +1048,18 @@ type ____TextStyle_InternalBase = Readonly<{
1047
1048
  }>;
1048
1049
 
1049
1050
  export type ____TextStyle_InternalCore = Readonly<{
1050
- ...$Exact<____ViewStyle_Internal>,
1051
+ ...$Exact<ViewStyle>,
1051
1052
  ...____TextStyle_InternalBase,
1052
1053
  }>;
1053
1054
 
1054
- export type ____TextStyle_Internal = Readonly<{
1055
+ /** @build-types emit-as-interface react-native-web compatibility */
1056
+ export type TextStyle = Readonly<{
1055
1057
  ...____TextStyle_InternalCore,
1056
1058
  ...____TextStyle_InternalOverrides,
1057
1059
  }>;
1058
1060
 
1059
1061
  export type ____ImageStyle_InternalCore = Readonly<{
1060
- ...$Exact<____ViewStyle_Internal>,
1062
+ ...$Exact<ViewStyle>,
1061
1063
  resizeMode?: ImageResizeMode,
1062
1064
  objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
1063
1065
  tintColor?: ____ColorValue_Internal,
@@ -1065,13 +1067,14 @@ export type ____ImageStyle_InternalCore = Readonly<{
1065
1067
  overflow?: 'visible' | 'hidden',
1066
1068
  }>;
1067
1069
 
1068
- export type ____ImageStyle_Internal = Readonly<{
1070
+ /** @build-types emit-as-interface react-native-web compatibility */
1071
+ export type ImageStyle = Readonly<{
1069
1072
  ...____ImageStyle_InternalCore,
1070
1073
  ...____ImageStyle_InternalOverrides,
1071
1074
  }>;
1072
1075
 
1073
1076
  export type ____DangerouslyImpreciseStyle_InternalCore = Readonly<{
1074
- ...$Exact<____TextStyle_Internal>,
1077
+ ...$Exact<TextStyle>,
1075
1078
  resizeMode?: ImageResizeMode,
1076
1079
  objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
1077
1080
  tintColor?: ____ColorValue_Internal,
@@ -1095,13 +1098,13 @@ export type ____DangerouslyImpreciseAnimatedStyleProp_Internal =
1095
1098
  WithAnimatedValue<StyleProp<Partial<____DangerouslyImpreciseStyle_Internal>>>;
1096
1099
 
1097
1100
  export type ____ViewStyleProp_Internal = StyleProp<
1098
- Readonly<Partial<____ViewStyle_Internal>>,
1101
+ Readonly<Partial<ViewStyle>>,
1099
1102
  >;
1100
1103
  export type ____TextStyleProp_Internal = StyleProp<
1101
- Readonly<Partial<____TextStyle_Internal>>,
1104
+ Readonly<Partial<TextStyle>>,
1102
1105
  >;
1103
1106
  export type ____ImageStyleProp_Internal = StyleProp<
1104
- Readonly<Partial<____ImageStyle_Internal>>,
1107
+ Readonly<Partial<ImageStyle>>,
1105
1108
  >;
1106
1109
 
1107
1110
  export type ____Styles_Internal = {
@@ -8,14 +8,14 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {____ViewStyle_Internal} from './StyleSheetTypes';
11
+ import type {ViewStyle} from './StyleSheetTypes';
12
12
 
13
- export default function splitLayoutProps(props: ?____ViewStyle_Internal): {
14
- outer: ?____ViewStyle_Internal,
15
- inner: ?____ViewStyle_Internal,
13
+ export default function splitLayoutProps(props: ?ViewStyle): {
14
+ outer: ?ViewStyle,
15
+ inner: ?ViewStyle,
16
16
  } {
17
- let outer: ?____ViewStyle_Internal = null;
18
- let inner: ?____ViewStyle_Internal = null;
17
+ let outer: ?ViewStyle = null;
18
+ let inner: ?ViewStyle = null;
19
19
 
20
20
  if (props != null) {
21
21
  // $FlowFixMe[incompatible-exact] Will contain a subset of keys from `props`.
@@ -10,7 +10,7 @@
10
10
 
11
11
  import type {HostInstance} from '../../src/private/types/HostInstance';
12
12
  import type {TextStyleProp} from '../StyleSheet/StyleSheet';
13
- import type {____TextStyle_Internal as TextStyleInternal} from '../StyleSheet/StyleSheetTypes';
13
+ import type {TextStyle} from '../StyleSheet/StyleSheetTypes';
14
14
  import type {GestureResponderEvent} from '../Types/CoreEventTypes';
15
15
  import type {NativeTextProps} from './TextNativeComponent';
16
16
  import type {PressRetentionOffset, TextProps} from './TextProps';
@@ -186,22 +186,22 @@ const TextImpl: component(
186
186
 
187
187
  let processedStyle = flattenStyle<TextStyleProp>(_style);
188
188
  if (processedStyle != null) {
189
- let overrides: ?{...TextStyleInternal} = null;
189
+ let overrides: ?{...TextStyle} = null;
190
190
  if (typeof processedStyle.fontWeight === 'number') {
191
- overrides = overrides || ({} as {...TextStyleInternal});
191
+ overrides = overrides || ({} as {...TextStyle});
192
192
  overrides.fontWeight =
193
193
  // $FlowFixMe[incompatible-type]
194
- String(processedStyle.fontWeight) as TextStyleInternal['fontWeight'];
194
+ String(processedStyle.fontWeight) as TextStyle['fontWeight'];
195
195
  }
196
196
 
197
197
  if (processedStyle.userSelect != null) {
198
198
  _selectable = userSelectToSelectableMap[processedStyle.userSelect];
199
- overrides = overrides || ({} as {...TextStyleInternal});
199
+ overrides = overrides || ({} as {...TextStyle});
200
200
  overrides.userSelect = undefined;
201
201
  }
202
202
 
203
203
  if (processedStyle.verticalAlign != null) {
204
- overrides = overrides || ({} as {...TextStyleInternal});
204
+ overrides = overrides || ({} as {...TextStyle});
205
205
  overrides.textAlignVertical =
206
206
  verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
207
207
  overrides.verticalAlign = undefined;
@@ -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,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(88),
26
- RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"0rc2",
26
+ RCTVersionPatch: @(1),
27
+ RCTVersionPrerelease: @"0",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -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-0rc2
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,
18
- "prerelease" to "0rc2"
17
+ "patch" to 1,
18
+ "prerelease" to "0"
19
19
  )
20
20
  }
@@ -88,6 +88,8 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
88
88
  view.setTag(R.id.accessibility_actions, null);
89
89
  view.setTag(R.id.accessibility_value, null);
90
90
  view.setTag(R.id.accessibility_state_expanded, null);
91
+ view.setTag(R.id.accessibility_state_disabled, null);
92
+ view.setEnabled(true);
91
93
  view.setTag(R.id.view_clipped, null);
92
94
 
93
95
  // This indirectly calls (and resets):
@@ -360,6 +362,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
360
362
  @ReactProp(name = ViewProps.ACCESSIBILITY_STATE)
361
363
  public void setViewState(@NonNull T view, @Nullable ReadableMap accessibilityState) {
362
364
  if (accessibilityState == null) {
365
+ resetDisabledFromAccessibilityState(view);
363
366
  return;
364
367
  }
365
368
  if (accessibilityState.hasKey("expanded")) {
@@ -381,8 +384,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
381
384
  view.setSelected(false);
382
385
  }
383
386
  view.setTag(R.id.accessibility_state, accessibilityState);
384
- if (accessibilityState.hasKey("disabled")) {
385
- view.setEnabled(!accessibilityState.getBoolean("disabled"));
387
+ if (accessibilityState.hasKey("disabled") && !accessibilityState.isNull("disabled")) {
388
+ boolean disabled = accessibilityState.getBoolean("disabled");
389
+ view.setEnabled(!disabled);
390
+ view.setTag(R.id.accessibility_state_disabled, disabled);
391
+ } else {
392
+ resetDisabledFromAccessibilityState(view);
386
393
  }
387
394
 
388
395
  // For states which don't have corresponding methods in
@@ -409,6 +416,13 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
409
416
  }
410
417
  }
411
418
 
419
+ private static void resetDisabledFromAccessibilityState(@NonNull View view) {
420
+ if (Boolean.TRUE.equals(view.getTag(R.id.accessibility_state_disabled))) {
421
+ view.setEnabled(true);
422
+ }
423
+ view.setTag(R.id.accessibility_state_disabled, null);
424
+ }
425
+
412
426
  private void updateViewContentDescription(@NonNull T view) {
413
427
  final String accessibilityLabel = (String) view.getTag(R.id.accessibility_label);
414
428
  final ReadableMap accessibilityState = (ReadableMap) view.getTag(R.id.accessibility_state);
@@ -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
 
@@ -611,20 +611,14 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
611
611
  }
612
612
 
613
613
  private fun manageFocusGuideAccessibilityDelegate(view: ReactViewGroup) {
614
- val accessibilityManager = view.context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
615
- val a11yServiceList = accessibilityManager.getEnabledAccessibilityServiceList(
616
- AccessibilityServiceInfo.FEEDBACK_SPOKEN)
617
- var isTalkbackInstalledAndEnabled = false
618
-
619
- for (serviceInfo in a11yServiceList) {
620
- val a11yServiceId = serviceInfo.id
621
- if (a11yServiceId != null && a11yServiceId.contains("talkback")) {
622
- isTalkbackInstalledAndEnabled = true
623
- }
624
- }
614
+ val hasDelegate = view.hasFocusGuideTalkbackAccessibilityDelegate()
615
+ // A view that is not a focus guide and has no delegate is left as it is whatever the
616
+ // TalkBack state, so skip the synchronous binder call to AccessibilityManagerService.
617
+ if (!hasDelegate && !view.isTVFocusGuide) return
625
618
 
619
+ val isTalkbackInstalledAndEnabled = isTalkbackEnabled(view.context)
626
620
  val isTVFocusable = view.descendantFocusability != ViewGroup.FOCUS_BLOCK_DESCENDANTS
627
- if (!view.hasFocusGuideTalkbackAccessibilityDelegate()) {
621
+ if (!hasDelegate) {
628
622
  if (view.isTVFocusGuide && isTVFocusable && isTalkbackInstalledAndEnabled) {
629
623
  // Custom accessibility delegate is needed only for Talkback,
630
624
  // as it's not handling TV focus guide scenarios as well as e.g. Amazon's VoiceView
@@ -643,6 +637,17 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
643
637
  }
644
638
  }
645
639
 
640
+ private fun isTalkbackEnabled(context: Context): Boolean {
641
+ val accessibilityManager =
642
+ context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
643
+ // isEnabled is answered from AccessibilityManager's local state; the service list is a
644
+ // binder call, so only ask for it when some accessibility service is running at all.
645
+ if (!accessibilityManager.isEnabled) return false
646
+ return accessibilityManager
647
+ .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN)
648
+ .any { it.id?.contains("talkback") == true }
649
+ }
650
+
646
651
  private fun hasTouchScreen(context: Context): Boolean {
647
652
  return context.packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)
648
653
  }