react-native-tvos 0.79.2-0 → 0.79.4-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 (65) hide show
  1. package/Libraries/AppDelegate/RCTReactNativeFactory.mm +0 -4
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/README.md +3 -1
  4. package/React/Base/RCTRootView.h +7 -1
  5. package/React/Base/RCTRootView.m +38 -0
  6. package/React/Base/RCTRootViewInternal.h +1 -0
  7. package/React/Base/RCTTVRemoteSelectHandler.h +4 -0
  8. package/React/Base/RCTTVRemoteSelectHandler.m +19 -6
  9. package/React/Base/RCTVersion.m +1 -1
  10. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +6 -0
  11. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +37 -0
  12. package/React/CoreModules/RCTDeviceInfo.mm +51 -19
  13. package/React/FBReactNativeSpec/FBReactNativeSpecJSI-generated.cpp +0 -6
  14. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +0 -9
  15. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +18 -4
  16. package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +1 -1
  17. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +3 -5
  18. package/React/Views/RCTTVView.m +4 -4
  19. package/ReactAndroid/gradle.properties +1 -1
  20. package/ReactAndroid/publish.gradle +5 -3
  21. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +1 -7
  22. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +1 -11
  23. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +1 -3
  24. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +1 -3
  25. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +1 -12
  26. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Stable_Android.kt +0 -2
  27. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +1 -3
  28. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  29. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +2 -2
  30. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
  31. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +8 -0
  32. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +20 -36
  33. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +1 -1
  34. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +0 -3
  35. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +1 -15
  36. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +1 -4
  37. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  38. package/ReactCommon/jsc/React-jsc.podspec +1 -1
  39. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +1 -5
  40. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +1 -6
  41. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +8 -26
  42. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +2 -4
  43. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +1 -5
  44. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +1 -10
  45. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +1 -2
  46. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +1 -6
  47. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +1 -3
  48. package/ReactCommon/react/runtime/TimerManager.cpp +6 -4
  49. package/ReactCommon/react/runtime/TimerManager.h +3 -1
  50. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +0 -1
  51. package/ReactCommon/react/runtime/tests/cxx/ReactInstanceTest.cpp +9 -5
  52. package/package.json +9 -8
  53. package/scripts/cocoapods/utils.rb +8 -3
  54. package/scripts/codegen/generate-artifacts-executor.js +55 -18
  55. package/sdks/.hermesversion +1 -1
  56. package/sdks/hermesc/osx-bin/hermes +0 -0
  57. package/sdks/hermesc/osx-bin/hermesc +0 -0
  58. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  59. package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
  60. package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
  61. package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
  62. package/src/private/featureflags/ReactNativeFeatureFlags.js +1 -6
  63. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
  64. package/types/index.d.ts +1 -1
  65. package/types/tsconfig.test.json +16 -0
@@ -314,10 +314,6 @@ class RCTAppDelegateBridgelessFeatureFlags : public ReactNativeFeatureFlagsDefau
314
314
  {
315
315
  return true;
316
316
  }
317
- bool updateRuntimeShadowNodeReferencesOnCommit() override
318
- {
319
- return true;
320
- }
321
317
  bool useShadowNodeStateOnClone() override
322
318
  {
323
319
  return true;
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 79,
19
- patch: 2,
19
+ patch: 4,
20
20
  prerelease: '0',
21
21
  };
22
22
 
package/README.md CHANGED
@@ -262,7 +262,9 @@ class Game2048 extends React.Component {
262
262
 
263
263
  - _LogBox_: The LogBox error/warning display (which replaced YellowBox in 0.63) is working as expected on TV platforms, after a few adjustments to make the controls accessible to the focus engine.
264
264
 
265
- - _Dev Menu support_: On the Apple TV simulator, cmd-D will bring up the developer menu, just like on iOS. To bring it up on a real Apple TV device, make a long press on the play/pause button on the remote. (Please do not shake the Apple TV device, that will not work :) ). Android TV dev menu behavior is the same as on Android phone.
265
+ - _Dev Menu support_:
266
+ - The developer menu provided by React Native itself works on TV. On the Apple TV simulator, cmd-D will bring up the developer menu, just like on iOS. To bring it up on a real Apple TV device, make a long press on the play/pause button on the remote. (Please do not shake the Apple TV device, that will not work :) ). Android TV dev menu behavior is the same as on Android phone.
267
+ - The Expo dev menu (provided by the [Expo dev client package](https://docs.expo.dev/versions/latest/sdk/dev-client/)) is *not* supported on TV.
266
268
 
267
269
  - _TV remote animations on Apple TV_: `RCTTVView` native code implements Apple-recommended parallax animations to help guide the eye as the user navigates through views. The animations can be disabled or adjusted with new optional view properties.
268
270
 
@@ -14,6 +14,9 @@
14
14
  extern NSString * _Nonnull const RCTTVEnableMenuKeyNotification;
15
15
  extern NSString * _Nonnull const RCTTVDisableMenuKeyNotification;
16
16
 
17
+ #if TARGET_OS_TV
18
+ #import "RCTTVRemoteSelectHandler.h"
19
+ #endif
17
20
 
18
21
  @protocol RCTRootViewDelegate;
19
22
 
@@ -51,8 +54,11 @@ extern
51
54
  * like any ordinary UIView. You can have multiple RCTRootViews on screen at
52
55
  * once, all controlled by the same JavaScript application.
53
56
  */
57
+ #if TARGET_OS_TV
58
+ @interface RCTRootView : UIView <RCTTVRemoteSelectHandlerDelegate>
59
+ #else
54
60
  @interface RCTRootView : UIView
55
-
61
+ #endif
56
62
  /**
57
63
  * - Designated initializer -
58
64
  */
@@ -31,6 +31,8 @@
31
31
  #if TARGET_OS_TV
32
32
  #import "RCTTVNavigationEventEmitter.h"
33
33
  #import "RCTTVRemoteHandler.h"
34
+ #import "RCTTVRemoteSelectHandler.h"
35
+ #import <React/RCTTVNavigationEventNotification.h>
34
36
  #endif
35
37
 
36
38
  #if RCT_DEV
@@ -98,6 +100,7 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
98
100
  #endif
99
101
 
100
102
  self.tvRemoteHandler = [[RCTTVRemoteHandler alloc] initWithView:self];
103
+ self.tvRemoteSelectHandler = [[RCTTVRemoteSelectHandler alloc] initWithView:self];
101
104
  #endif
102
105
 
103
106
  [self showLoadingView];
@@ -424,10 +427,45 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
424
427
  {
425
428
  #if TARGET_OS_TV
426
429
  self.tvRemoteHandler = nil;
430
+ self.tvRemoteSelectHandler = nil;
427
431
  #endif
428
432
  [_contentView invalidate];
429
433
  }
430
434
 
435
+ #if TARGET_OS_TV
436
+
437
+ #pragma mark -
438
+ #pragma mark RCTTVRemoteSelectHandlerDelegate methods
439
+
440
+ - (void)animatePressIn {
441
+ }
442
+
443
+ - (void)animatePressOut {
444
+ }
445
+
446
+ - (void)emitPressInEvent {
447
+ }
448
+
449
+ - (void)emitPressOutEvent {
450
+ }
451
+
452
+ - (void)sendSelectNotification
453
+ {
454
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventSelect keyAction:RCTTVRemoteEventKeyActionUp tag:self.reactTag target:self.reactTag];
455
+ }
456
+
457
+ - (void)sendLongSelectBeganNotification
458
+ {
459
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:RCTTVRemoteEventKeyActionDown tag:self.reactTag target:self.reactTag];
460
+ }
461
+
462
+ - (void)sendLongSelectEndedNotification
463
+ {
464
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:RCTTVRemoteEventKeyActionUp tag:self.reactTag target:self.reactTag];
465
+ }
466
+
467
+ #endif
468
+
431
469
  @end
432
470
 
433
471
  @implementation RCTRootView (Deprecated)
@@ -26,6 +26,7 @@
26
26
  */
27
27
  #if TARGET_OS_TV
28
28
  @property (nonatomic, strong, nullable) RCTTVRemoteHandler *tvRemoteHandler;
29
+ @property (nonatomic, strong, nullable) RCTTVRemoteSelectHandler *tvRemoteSelectHandler;
29
30
  @property (nonatomic, weak) UIView *reactPreferredFocusedView;
30
31
  @property (nonatomic, copy, nullable) NSArray<id<UIFocusEnvironment>> *reactPreferredFocusEnvironments;
31
32
  #endif
@@ -24,4 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
24
24
 
25
25
  @end
26
26
 
27
+ @interface RCTTVRemoteSelectGestureRecognizer: UILongPressGestureRecognizer
28
+
29
+ @end
30
+
27
31
  NS_ASSUME_NONNULL_END
@@ -1,16 +1,17 @@
1
1
  #import "RCTTVRemoteSelectHandler.h"
2
+ #import "RCTTVRemoteHandler.h"
2
3
 
3
4
  @interface RCTTVRemoteSelectHandler()
4
5
 
5
- @property (nonatomic, strong) UILongPressGestureRecognizer * pressRecognizer;
6
- @property (nonatomic, strong) UILongPressGestureRecognizer * longPressRecognizer;
6
+ @property (nonatomic, strong) RCTTVRemoteSelectGestureRecognizer * pressRecognizer;
7
+ @property (nonatomic, strong) RCTTVRemoteSelectGestureRecognizer * longPressRecognizer;
7
8
 
8
9
  @property (nonatomic, weak) UIView<RCTTVRemoteSelectHandlerDelegate> *view;
9
10
 
10
11
  @end
11
12
 
12
13
  @implementation RCTTVRemoteSelectHandler {
13
- NSMutableDictionary<NSString *, UIGestureRecognizer *> *_tvRemoteGestureRecognizers;
14
+ NSMutableDictionary<NSString *, RCTTVRemoteSelectGestureRecognizer *> *_tvRemoteGestureRecognizers;
14
15
  }
15
16
 
16
17
  #pragma mark -
@@ -36,14 +37,21 @@
36
37
 
37
38
  // Press recognizer should allow long press recognizer to work (but not the reverse)
38
39
  - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
39
- return gestureRecognizer == _pressRecognizer;
40
+ // We need to allow other external select gesture recognizers to run, but not
41
+ // the select recognizers for pressable subviews of the root view.
42
+
43
+ if (gestureRecognizer == self.pressRecognizer && otherGestureRecognizer == self.longPressRecognizer) {
44
+ return true;
45
+ } else {
46
+ return ![otherGestureRecognizer isKindOfClass:[RCTTVRemoteSelectGestureRecognizer class]];
47
+ }
40
48
  }
41
49
 
42
50
  #pragma mark -
43
51
  #pragma mark Private methods
44
52
 
45
53
  - (void)attachToView {
46
- UILongPressGestureRecognizer *pressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)];
54
+ RCTTVRemoteSelectGestureRecognizer *pressRecognizer = [[RCTTVRemoteSelectGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)];
47
55
  pressRecognizer.allowedPressTypes = @[ @(UIPressTypeSelect) ];
48
56
  pressRecognizer.minimumPressDuration = 0.0;
49
57
  pressRecognizer.delegate = self; // Press recognizer allows other recognizers to run
@@ -51,9 +59,10 @@
51
59
  [self.view addGestureRecognizer:pressRecognizer];
52
60
  self.pressRecognizer = pressRecognizer;
53
61
 
54
- UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
62
+ RCTTVRemoteSelectGestureRecognizer *longPressRecognizer = [[RCTTVRemoteSelectGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
55
63
  longPressRecognizer.allowedPressTypes = @[ @(UIPressTypeSelect) ];
56
64
  longPressRecognizer.minimumPressDuration = 0.5;
65
+ longPressRecognizer.delegate = self;
57
66
 
58
67
  [self.view addGestureRecognizer:longPressRecognizer];
59
68
  self.longPressRecognizer = longPressRecognizer;
@@ -118,3 +127,7 @@
118
127
  }
119
128
 
120
129
  @end
130
+
131
+ @implementation RCTTVRemoteSelectGestureRecognizer
132
+
133
+ @end
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(79),
26
- RCTVersionPatch: @(2),
26
+ RCTVersionPatch: @(4),
27
27
  RCTVersionPrerelease: @"0",
28
28
  };
29
29
  });
@@ -14,6 +14,7 @@
14
14
 
15
15
  #if TARGET_OS_TV
16
16
  #import <React/RCTTVRemoteHandler.h>
17
+ #import <React/RCTTVRemoteSelectHandler.h>
17
18
  #endif
18
19
 
19
20
  NS_ASSUME_NONNULL_BEGIN
@@ -25,7 +26,11 @@ NS_ASSUME_NONNULL_BEGIN
25
26
  *
26
27
  * WARNING: In the future, RCTRootView will be deprecated in favor of RCTSurfaceHostingView.
27
28
  */
29
+ #if TARGET_OS_TV
30
+ @interface RCTSurfaceHostingProxyRootView : RCTSurfaceHostingView <RCTTVRemoteSelectHandlerDelegate>
31
+ #else
28
32
  @interface RCTSurfaceHostingProxyRootView : RCTSurfaceHostingView
33
+ #endif
29
34
 
30
35
  #pragma mark RCTRootView compatibility - keep these sync'ed with RCTRootView.h
31
36
 
@@ -44,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
44
49
  @property (nonatomic, assign) CGSize minimumSize;
45
50
  #if TARGET_OS_TV
46
51
  @property (nonatomic, strong, nullable) RCTTVRemoteHandler *tvRemoteHandler;
52
+ @property (nonatomic, strong, nullable) RCTTVRemoteSelectHandler *tvRemoteSelectHandler;
47
53
  @property (nonatomic, weak, nullable) UIView *reactPreferredFocusedView;
48
54
  @property (nonatomic, copy, nullable) NSArray<id<UIFocusEnvironment>> *reactPreferredFocusEnvironments;
49
55
  #endif
@@ -20,6 +20,10 @@
20
20
  #import "RCTSurface.h"
21
21
  #import "UIView+React.h"
22
22
 
23
+ #if TARGET_OS_TV
24
+ #import <React/RCTTVNavigationEventNotification.h>
25
+ #endif
26
+
23
27
  static RCTSurfaceSizeMeasureMode convertToSurfaceSizeMeasureMode(RCTRootViewSizeFlexibility sizeFlexibility)
24
28
  {
25
29
  switch (sizeFlexibility) {
@@ -61,9 +65,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
61
65
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
62
66
 
63
67
  #if TARGET_OS_TV
68
+
64
69
  - (void)dealloc
65
70
  {
66
71
  self.tvRemoteHandler = nil;
72
+ self.tvRemoteSelectHandler = nil;
67
73
  }
68
74
 
69
75
  - (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
@@ -78,6 +84,36 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
78
84
  }
79
85
  return [super preferredFocusEnvironments];
80
86
  }
87
+
88
+ #pragma mark -
89
+ #pragma mark RCTTVRemoteSelectHandlerDelegate methods
90
+
91
+ - (void)animatePressIn {
92
+ }
93
+
94
+ - (void)animatePressOut {
95
+ }
96
+
97
+ - (void)emitPressInEvent {
98
+ }
99
+
100
+ - (void)emitPressOutEvent {
101
+ }
102
+
103
+ - (void)sendSelectNotification
104
+ {
105
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventSelect keyAction:RCTTVRemoteEventKeyActionUp tag:self.reactTag target:self.reactTag];
106
+ }
107
+
108
+ - (void)sendLongSelectBeganNotification
109
+ {
110
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:RCTTVRemoteEventKeyActionDown tag:self.reactTag target:self.reactTag];
111
+ }
112
+
113
+ - (void)sendLongSelectEndedNotification
114
+ {
115
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:RCTTVRemoteEventKeyActionUp tag:self.reactTag target:self.reactTag];
116
+ }
81
117
  #endif
82
118
 
83
119
 
@@ -145,6 +181,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
145
181
  dispatch_async(dispatch_get_main_queue(), ^{
146
182
  #if TARGET_OS_TV
147
183
  self.tvRemoteHandler = [[RCTTVRemoteHandler alloc] initWithView:[self contentView]];
184
+ self.tvRemoteSelectHandler = [[RCTTVRemoteSelectHandler alloc] initWithView:self];
148
185
  #endif
149
186
  });
150
187
  }
@@ -14,9 +14,7 @@
14
14
  #import <React/RCTEventDispatcherProtocol.h>
15
15
  #import <React/RCTInitializing.h>
16
16
  #import <React/RCTInvalidating.h>
17
- #import <React/RCTKeyWindowValuesProxy.h>
18
17
  #import <React/RCTUtils.h>
19
- #import <React/RCTWindowSafeAreaProxy.h>
20
18
  #import <atomic>
21
19
 
22
20
  #import "CoreModulesPlugins.h"
@@ -33,8 +31,13 @@ using namespace facebook::react;
33
31
  NSDictionary *_currentInterfaceDimensions;
34
32
  BOOL _isFullscreen;
35
33
  std::atomic<BOOL> _invalidated;
34
+ NSDictionary *_constants;
35
+
36
+ __weak UIWindow *_applicationWindow;
36
37
  }
37
38
 
39
+ static NSString *const kFrameKeyPath = @"frame";
40
+
38
41
  @synthesize moduleRegistry = _moduleRegistry;
39
42
 
40
43
  RCT_EXPORT_MODULE()
@@ -42,14 +45,28 @@ RCT_EXPORT_MODULE()
42
45
  - (instancetype)init
43
46
  {
44
47
  if (self = [super init]) {
45
- [[RCTKeyWindowValuesProxy sharedInstance] startObservingWindowSizeIfNecessary];
48
+ _applicationWindow = RCTKeyWindow();
49
+ [_applicationWindow addObserver:self forKeyPath:kFrameKeyPath options:NSKeyValueObservingOptionNew context:nil];
46
50
  }
47
51
  return self;
48
52
  }
49
53
 
54
+ - (void)observeValueForKeyPath:(NSString *)keyPath
55
+ ofObject:(id)object
56
+ change:(NSDictionary *)change
57
+ context:(void *)context
58
+ {
59
+ #if !TARGET_OS_TV
60
+ if ([keyPath isEqualToString:kFrameKeyPath]) {
61
+ [self interfaceFrameDidChange];
62
+ [[NSNotificationCenter defaultCenter] postNotificationName:RCTWindowFrameDidChangeNotification object:self];
63
+ }
64
+ #endif
65
+ }
66
+
50
67
  + (BOOL)requiresMainQueueSetup
51
68
  {
52
- return NO;
69
+ return YES;
53
70
  }
54
71
 
55
72
  - (dispatch_queue_t)methodQueue
@@ -85,7 +102,7 @@ RCT_EXPORT_MODULE()
85
102
 
86
103
  #if TARGET_OS_IOS
87
104
 
88
- _currentInterfaceOrientation = [RCTKeyWindowValuesProxy sharedInstance].currentInterfaceOrientation;
105
+ _currentInterfaceOrientation = RCTKeyWindow().windowScene.interfaceOrientation;
89
106
 
90
107
  [[NSNotificationCenter defaultCenter] addObserver:self
91
108
  selector:@selector(interfaceFrameDidChange)
@@ -102,6 +119,15 @@ RCT_EXPORT_MODULE()
102
119
  selector:@selector(invalidate)
103
120
  name:RCTBridgeWillInvalidateModulesNotification
104
121
  object:nil];
122
+
123
+ _constants = @{
124
+ @"Dimensions" : [self _exportedDimensions],
125
+ // Note:
126
+ // This prop is deprecated and will be removed in a future release.
127
+ // Please use this only for a quick and temporary solution.
128
+ // Use <SafeAreaView> instead.
129
+ @"isIPhoneX_deprecated" : @(RCTIsIPhoneNotched()),
130
+ };
105
131
  }
106
132
 
107
133
  - (void)invalidate
@@ -124,6 +150,8 @@ RCT_EXPORT_MODULE()
124
150
 
125
151
  [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
126
152
 
153
+ [_applicationWindow removeObserver:self forKeyPath:kFrameKeyPath];
154
+
127
155
  #if TARGET_OS_IOS
128
156
  [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
129
157
  #endif
@@ -136,8 +164,13 @@ static BOOL RCTIsIPhoneNotched()
136
164
  #if TARGET_OS_IOS
137
165
  static dispatch_once_t onceToken;
138
166
  dispatch_once(&onceToken, ^{
167
+ RCTAssertMainQueue();
168
+
139
169
  // 20pt is the top safeArea value in non-notched devices
140
- isIPhoneNotched = [RCTWindowSafeAreaProxy sharedInstance].currentSafeAreaInsets.top > 20;
170
+ UIWindow *keyWindow = RCTKeyWindow();
171
+ if (keyWindow) {
172
+ isIPhoneNotched = keyWindow.safeAreaInsets.top > 20;
173
+ }
141
174
  });
142
175
  #endif
143
176
 
@@ -146,11 +179,13 @@ static BOOL RCTIsIPhoneNotched()
146
179
 
147
180
  static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
148
181
  {
182
+ RCTAssertMainQueue();
149
183
  UIScreen *mainScreen = UIScreen.mainScreen;
150
184
  CGSize screenSize = mainScreen.bounds.size;
185
+ UIView *mainWindow = RCTKeyWindow();
151
186
 
152
187
  // We fallback to screen size if a key window is not found.
153
- CGSize windowSize = [RCTKeyWindowValuesProxy sharedInstance].windowSize;
188
+ CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
154
189
 
155
190
  NSDictionary<NSString *, NSNumber *> *dimsWindow = @{
156
191
  @"width" : @(windowSize.width),
@@ -174,7 +209,10 @@ static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
174
209
  RCTAssert(_moduleRegistry, @"Failed to get exported dimensions: RCTModuleRegistry is nil");
175
210
  RCTAccessibilityManager *accessibilityManager =
176
211
  (RCTAccessibilityManager *)[_moduleRegistry moduleForName:"AccessibilityManager"];
177
- RCTAssert(accessibilityManager, @"Failed to get exported dimensions: AccessibilityManager is nil");
212
+ // TOOD(T225745315): For some reason, accessibilityManager is nil in some cases.
213
+ // We default the fontScale to 1.0 in this case. This should be okay: if we assume
214
+ // that accessibilityManager will eventually become available, js will eventually
215
+ // be updated with the correct fontScale.
178
216
  CGFloat fontScale = accessibilityManager ? accessibilityManager.multiplier : 1.0;
179
217
  return RCTExportedDimensions(fontScale);
180
218
  }
@@ -186,14 +224,7 @@ static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
186
224
 
187
225
  - (NSDictionary<NSString *, id> *)getConstants
188
226
  {
189
- return @{
190
- @"Dimensions" : [self _exportedDimensions],
191
- // Note:
192
- // This prop is deprecated and will be removed in a future release.
193
- // Please use this only for a quick and temporary solution.
194
- // Use <SafeAreaView> instead.
195
- @"isIPhoneX_deprecated" : @(RCTIsIPhoneNotched()),
196
- };
227
+ return _constants;
197
228
  }
198
229
 
199
230
  - (void)didReceiveNewContentSizeMultiplier
@@ -215,10 +246,11 @@ static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
215
246
  - (void)interfaceOrientationDidChange
216
247
  {
217
248
  #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
218
- UIWindow *keyWindow = RCTKeyWindow();
219
- UIInterfaceOrientation nextOrientation = keyWindow.windowScene.interfaceOrientation;
249
+ UIApplication *application = RCTSharedApplication();
250
+ UIInterfaceOrientation nextOrientation = RCTKeyWindow().windowScene.interfaceOrientation;
220
251
 
221
- BOOL isRunningInFullScreen = CGRectEqualToRect(keyWindow.frame, keyWindow.screen.bounds);
252
+ BOOL isRunningInFullScreen =
253
+ CGRectEqualToRect(application.delegate.window.frame, application.delegate.window.screen.bounds);
222
254
  // We are catching here two situations for multitasking view:
223
255
  // a) The app is in Split View and the container gets resized -> !isRunningInFullScreen
224
256
  // b) The app changes to/from fullscreen example: App runs in slide over mode and goes into fullscreen->
@@ -201,11 +201,6 @@ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useAlwa
201
201
  rt
202
202
  );
203
203
  }
204
- static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useEditTextStockAndroidFocusBehavior(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
205
- return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->useEditTextStockAndroidFocusBehavior(
206
- rt
207
- );
208
- }
209
204
  static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useFabricInterop(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
210
205
  return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->useFabricInterop(
211
206
  rt
@@ -282,7 +277,6 @@ NativeReactNativeFeatureFlagsCxxSpecJSI::NativeReactNativeFeatureFlagsCxxSpecJSI
282
277
  methodMap_["traceTurboModulePromiseRejectionsOnAndroid"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_traceTurboModulePromiseRejectionsOnAndroid};
283
278
  methodMap_["updateRuntimeShadowNodeReferencesOnCommit"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_updateRuntimeShadowNodeReferencesOnCommit};
284
279
  methodMap_["useAlwaysAvailableJSErrorHandling"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useAlwaysAvailableJSErrorHandling};
285
- methodMap_["useEditTextStockAndroidFocusBehavior"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useEditTextStockAndroidFocusBehavior};
286
280
  methodMap_["useFabricInterop"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useFabricInterop};
287
281
  methodMap_["useNativeViewConfigsInBridgelessMode"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useNativeViewConfigsInBridgelessMode};
288
282
  methodMap_["useOptimizedEventBatchingOnAndroid"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useOptimizedEventBatchingOnAndroid};
@@ -58,7 +58,6 @@ public:
58
58
  virtual bool traceTurboModulePromiseRejectionsOnAndroid(jsi::Runtime &rt) = 0;
59
59
  virtual bool updateRuntimeShadowNodeReferencesOnCommit(jsi::Runtime &rt) = 0;
60
60
  virtual bool useAlwaysAvailableJSErrorHandling(jsi::Runtime &rt) = 0;
61
- virtual bool useEditTextStockAndroidFocusBehavior(jsi::Runtime &rt) = 0;
62
61
  virtual bool useFabricInterop(jsi::Runtime &rt) = 0;
63
62
  virtual bool useNativeViewConfigsInBridgelessMode(jsi::Runtime &rt) = 0;
64
63
  virtual bool useOptimizedEventBatchingOnAndroid(jsi::Runtime &rt) = 0;
@@ -400,14 +399,6 @@ private:
400
399
  return bridging::callFromJs<bool>(
401
400
  rt, &T::useAlwaysAvailableJSErrorHandling, jsInvoker_, instance_);
402
401
  }
403
- bool useEditTextStockAndroidFocusBehavior(jsi::Runtime &rt) override {
404
- static_assert(
405
- bridging::getParameterCount(&T::useEditTextStockAndroidFocusBehavior) == 1,
406
- "Expected useEditTextStockAndroidFocusBehavior(...) to have 1 parameters");
407
-
408
- return bridging::callFromJs<bool>(
409
- rt, &T::useEditTextStockAndroidFocusBehavior, jsInvoker_, instance_);
410
- }
411
402
  bool useFabricInterop(jsi::Runtime &rt) override {
412
403
  static_assert(
413
404
  bridging::getParameterCount(&T::useFabricInterop) == 1,
@@ -170,10 +170,24 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
170
170
 
171
171
  - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
172
172
  {
173
- [_viewsToBeMounted addObject:@{
174
- kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
175
- kRCTLegacyInteropChildComponentKey : childComponentView
176
- }];
173
+ if (_adapter && index == _adapter.paperView.reactSubviews.count) {
174
+ // This is a new child view that is being added to the end of the children array.
175
+ // After the children is added, we need to call didUpdateReactSubviews to make sure that it is rendered.
176
+ // Without this change, the new child will not be rendered right away because the didUpdateReactSubviews is not
177
+ // called and the `finalizeUpdate` is not invoked.
178
+ if ([childComponentView isKindOfClass:[RCTLegacyViewManagerInteropComponentView class]]) {
179
+ UIView *target = ((RCTLegacyViewManagerInteropComponentView *)childComponentView).contentView;
180
+ [_adapter.paperView insertReactSubview:target atIndex:index];
181
+ } else {
182
+ [_adapter.paperView insertReactSubview:childComponentView atIndex:index];
183
+ }
184
+ [_adapter.paperView didUpdateReactSubviews];
185
+ } else {
186
+ [_viewsToBeMounted addObject:@{
187
+ kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
188
+ kRCTLegacyInteropChildComponentKey : childComponentView
189
+ }];
190
+ }
177
191
  }
178
192
 
179
193
  - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
@@ -68,7 +68,7 @@ using namespace facebook::react;
68
68
  const auto &newSwitchProps = static_cast<const SwitchProps &>(*props);
69
69
 
70
70
  // `value`
71
- if (oldSwitchProps.value != newSwitchProps.value) {
71
+ if (!_isInitialValueSet || oldSwitchProps.value != newSwitchProps.value) {
72
72
  BOOL shouldAnimate = _isInitialValueSet == YES;
73
73
  [_switchView setOn:newSwitchProps.value animated:shouldAnimate];
74
74
  }
@@ -587,23 +587,21 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
587
587
  }
588
588
 
589
589
  if (context.nextFocusedView == self) {
590
- if(_eventEmitter) _eventEmitter->onFocus();
591
-
592
590
  [self becomeFirstResponder];
593
591
  [self enableDirectionalFocusGuides];
594
592
  [coordinator addCoordinatedAnimations:^(void){
595
- [self addParallaxMotionEffects];
593
+ if (self->_eventEmitter) self->_eventEmitter->onFocus();
596
594
  [self sendFocusNotification:context];
595
+ [self addParallaxMotionEffects];
597
596
  } completion:^(void){}];
598
597
  // Without this check, onBlur would also trigger when `TVFocusGuideView` transfers focus to its children.
599
598
  // [self isTVFocusGuide] is false when autofocus and destinations are not used, so we cannot use that.
600
599
  // Generally speaking, it would happen for any non-collapsable `View`.
601
600
  } else if (context.previouslyFocusedView == self) {
602
- if (_eventEmitter) _eventEmitter->onBlur();
603
-
604
601
  [self disableDirectionalFocusGuides];
605
602
  [coordinator addCoordinatedAnimations:^(void){
606
603
  [self removeParallaxMotionEffects];
604
+ if (self->_eventEmitter) self->_eventEmitter->onBlur();
607
605
  [self sendBlurNotification:context];
608
606
  } completion:^(void){}];
609
607
  [self resignFirstResponder];
@@ -304,22 +304,22 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
304
304
  }
305
305
 
306
306
  if (context.nextFocusedView == self) {
307
- if (self.onFocus) self.onFocus(nil);
308
307
  [self becomeFirstResponder];
309
308
  [self enableDirectionalFocusGuides];
310
309
  [coordinator addCoordinatedAnimations:^(void){
311
- [self addParallaxMotionEffects];
310
+ if (self.onFocus) self.onFocus(nil);
312
311
  [self sendFocusNotification:context];
312
+ [self addParallaxMotionEffects];
313
313
  } completion:^(void){}];
314
314
  // Without this check, onBlur would also trigger when `TVFocusGuideView` transfers focus to its children.
315
315
  // [self isTVFocusGuide] is false when autofocus and destinations are not used, so we cannot use that.
316
316
  // Generally speaking, it would happen for any non-collapsable `View`.
317
317
  } else if (context.previouslyFocusedView == self ) {
318
- if (self.onBlur) self.onBlur(nil);
319
318
  [self disableDirectionalFocusGuides];
320
319
  [coordinator addCoordinatedAnimations:^(void){
321
- [self sendBlurNotification:context];
322
320
  [self removeParallaxMotionEffects];
321
+ if (self.onBlur) self.onBlur(nil);
322
+ [self sendBlurNotification:context];
323
323
  } completion:^(void){}];
324
324
  [self resignFirstResponder];
325
325
  }
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.79.2-0
1
+ VERSION_NAME=0.79.4-0
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
 
4
4
  android.useAndroidX=true
@@ -20,7 +20,7 @@ def sonatypeUsername = findProperty('SONATYPE_USERNAME')
20
20
  def sonatypePassword = findProperty('SONATYPE_PASSWORD')
21
21
 
22
22
  def reactAndroidProjectDir = project(':packages:react-native:ReactAndroid').projectDir
23
- def mavenTempLocalUrl = 'file:///var/folders/xp/yw_lp59x05d2mp0g0n2f_d240000gn/T/eas-build-workingdir/build/maven_local'
23
+ def mavenTempLocalUrl = 'file:///Users/expo/workingdir/build/maven_local'
24
24
  // Rewritten when copying this to ReactAndroid/publish.gradle
25
25
 
26
26
  publishing {
@@ -78,7 +78,8 @@ publishing {
78
78
  }
79
79
  maven {
80
80
  name = 'sonatypeRelease'
81
- url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
81
+ url = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
82
+ // url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
82
83
  credentials(PasswordCredentials) {
83
84
  username = sonatypeUsername
84
85
  password = sonatypePassword
@@ -86,7 +87,8 @@ publishing {
86
87
  }
87
88
  maven {
88
89
  name = 'sonatypeSnapshot'
89
- url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
90
+ url = 'https://central.sonatype.com/repository/maven-snapshots/'
91
+ // url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
90
92
  credentials(PasswordCredentials) {
91
93
  username = sonatypeUsername
92
94
  password = sonatypePassword