react-native-tvos 0.74.0-0rc0 → 0.74.0-0rc2

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 (85) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.mm +10 -5
  2. package/Libraries/AppDelegate/RCTRootViewFactory.h +13 -3
  3. package/Libraries/AppDelegate/RCTRootViewFactory.mm +25 -10
  4. package/Libraries/Components/Pressable/Pressable.js +9 -13
  5. package/Libraries/Components/Touchable/TVTouchable.js +1 -1
  6. package/Libraries/Components/Touchable/TouchableHighlight.js +2 -2
  7. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  8. package/Libraries/Components/Touchable/TouchableOpacity.js +2 -2
  9. package/Libraries/Core/ReactNativeVersion.js +1 -1
  10. package/Libraries/Pressability/Pressability.js +5 -0
  11. package/Libraries/ReactNative/AppContainer-dev.js +21 -2
  12. package/React/Base/RCTBridge+Inspector.h +30 -0
  13. package/React/Base/RCTBridge+Private.h +0 -20
  14. package/React/Base/RCTBridge.mm +1 -0
  15. package/React/Base/RCTBridgeProxy.h +6 -1
  16. package/React/Base/RCTBridgeProxy.mm +4 -2
  17. package/React/Base/RCTTVNavigationEventNotification.h +37 -0
  18. package/React/Base/RCTTVNavigationEventNotification.mm +106 -0
  19. package/React/Base/RCTTVNavigationEventNotificationConstants.h +25 -0
  20. package/React/Base/RCTTVNavigationEventNotificationConstants.mm +18 -0
  21. package/React/Base/RCTTVRemoteHandler.h +0 -26
  22. package/React/Base/RCTTVRemoteHandler.m +34 -90
  23. package/React/Base/RCTTVRemoteHandlerConstants.h +37 -0
  24. package/React/Base/RCTTVRemoteHandlerConstants.mm +32 -0
  25. package/React/Base/RCTVersion.m +1 -1
  26. package/React/CoreModules/RCTDevSettings.mm +1 -0
  27. package/React/CoreModules/RCTDeviceInfo.mm +15 -16
  28. package/React/CoreModules/RCTTVNavigationEventEmitter.mm +2 -1
  29. package/React/CxxBridge/RCTCxxBridge.mm +1 -0
  30. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +11 -12
  31. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +6 -17
  32. package/React/Fabric/RCTSurfacePointerHandler.mm +1 -0
  33. package/React/Modules/RCTUIManager.m +10 -0
  34. package/React/Views/RCTTVView.m +6 -17
  35. package/React/Views/ScrollView/RCTScrollView.m +11 -12
  36. package/ReactAndroid/api/ReactAndroid.api +25 -1
  37. package/ReactAndroid/build.gradle.kts +18 -6
  38. package/ReactAndroid/gradle.properties +1 -1
  39. package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
  40. package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +1 -1
  41. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
  42. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +14 -36
  43. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +106 -9
  44. package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
  45. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
  46. package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
  47. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +12 -7
  48. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  49. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +64 -0
  50. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +4 -0
  51. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +1 -7
  52. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +6 -1
  53. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
  54. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
  55. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  56. package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +1 -1
  57. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +4 -1
  58. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +1 -1
  59. package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
  60. package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +0 -1
  61. package/ReactCommon/react/runtime/iostests/RCTHostTests.mm +2 -1
  62. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h +0 -2
  63. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +10 -1
  64. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +32 -9
  65. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +2 -1
  66. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +6 -12
  67. package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.h +1 -1
  68. package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.mm +3 -2
  69. package/ReactCommon/yoga/Yoga.podspec +4 -1
  70. package/package.json +22 -14
  71. package/scripts/cocoapods/helpers.rb +4 -0
  72. package/scripts/cocoapods/utils.rb +27 -7
  73. package/scripts/react_native_pods.rb +2 -0
  74. package/scripts/xcode/ccache-clang++.sh +14 -0
  75. package/scripts/xcode/ccache-clang.sh +14 -0
  76. package/scripts/xcode/ccache.conf +11 -0
  77. package/sdks/hermes-engine/utils/build-ios-framework.sh +5 -0
  78. package/sdks/hermes-engine/utils/build-mac-framework.sh +5 -0
  79. package/sdks/hermesc/osx-bin/hermes +0 -0
  80. package/sdks/hermesc/osx-bin/hermesc +0 -0
  81. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  82. package/template/ios/HelloWorld/PrivacyInfo.xcprivacy +38 -0
  83. package/template/package.json +6 -6
  84. package/third-party-podspecs/RCT-Folly.podspec +2 -2
  85. package/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java +0 -23
@@ -15,6 +15,7 @@
15
15
  #import "RCTLog.h"
16
16
  #import "RCTRootView.h"
17
17
  #import "RCTTVNavigationEventEmitter.h"
18
+ #import "RCTTVNavigationEventNotification.h"
18
19
  #import "RCTUIManager.h"
19
20
  #import "RCTUtils.h"
20
21
  #import "RCTView.h"
@@ -29,32 +30,6 @@ NSString *const RCTTVDisablePanGestureNotification = @"RCTTVDisablePanGestureNot
29
30
  NSString *const RCTTVEnableGestureHandlersCancelTouchesNotification = @"RCTTVEnableGestureHandlersCancelTouchesNotification";
30
31
  NSString *const RCTTVDisableGestureHandlersCancelTouchesNotification = @"RCTTVDisableGestureHandlersCancelTouchesNotification";
31
32
 
32
- NSString *const RCTTVRemoteEventMenu = @"menu";
33
- NSString *const RCTTVRemoteEventPlayPause = @"playPause";
34
- NSString *const RCTTVRemoteEventSelect = @"select";
35
-
36
- NSString *const RCTTVRemoteEventLongPlayPause = @"longPlayPause";
37
- NSString *const RCTTVRemoteEventLongSelect = @"longSelect";
38
- NSString *const RCTTVRemoteEventLongUp = @"longUp";
39
- NSString *const RCTTVRemoteEventLongDown = @"longDown";
40
- NSString *const RCTTVRemoteEventLongLeft = @"longLeft";
41
- NSString *const RCTTVRemoteEventLongRight = @"longRight";
42
-
43
- NSString *const RCTTVRemoteEventLeft = @"left";
44
- NSString *const RCTTVRemoteEventRight = @"right";
45
- NSString *const RCTTVRemoteEventUp = @"up";
46
- NSString *const RCTTVRemoteEventDown = @"down";
47
-
48
- NSString *const RCTTVRemoteEventPageUp = @"pageUp";
49
- NSString *const RCTTVRemoteEventPageDown = @"pageDown";
50
-
51
- NSString *const RCTTVRemoteEventSwipeLeft = @"swipeLeft";
52
- NSString *const RCTTVRemoteEventSwipeRight = @"swipeRight";
53
- NSString *const RCTTVRemoteEventSwipeUp = @"swipeUp";
54
- NSString *const RCTTVRemoteEventSwipeDown = @"swipeDown";
55
-
56
- NSString *const RCTTVRemoteEventPan = @"pan";
57
-
58
33
  @interface RCTTVRemoteHandler()
59
34
 
60
35
  @property (nonatomic, copy, readonly) NSDictionary<NSString *, UIGestureRecognizer *> *tvRemoteGestureRecognizers;
@@ -349,7 +324,8 @@ static __volatile BOOL __gestureHandlersCancelTouches = YES;
349
324
  for (NSString *name in [self.tvRemoteGestureRecognizers allKeys]) {
350
325
  self.tvRemoteGestureRecognizers[name].cancelsTouchesInView = YES;
351
326
  }
352
- [self.tvMenuKeyRecognizer setCancelsTouchesInView:YES];
327
+ // Issue #678: menu key should not be included
328
+ // [self.tvMenuKeyRecognizer setCancelsTouchesInView:YES];
353
329
  [self.tvPanGestureRecognizer setCancelsTouchesInView:YES];
354
330
  });
355
331
  }
@@ -360,7 +336,8 @@ static __volatile BOOL __gestureHandlersCancelTouches = YES;
360
336
  for (NSString *name in [self.tvRemoteGestureRecognizers allKeys]) {
361
337
  self.tvRemoteGestureRecognizers[name].cancelsTouchesInView = NO;
362
338
  }
363
- [self.tvMenuKeyRecognizer setCancelsTouchesInView:NO];
339
+ // Issue #678: menu key should not be included
340
+ // [self.tvMenuKeyRecognizer setCancelsTouchesInView:NO];
364
341
  [self.tvPanGestureRecognizer setCancelsTouchesInView:NO];
365
342
  });
366
343
  }
@@ -370,117 +347,117 @@ static __volatile BOOL __gestureHandlersCancelTouches = YES;
370
347
 
371
348
  - (void)playPausePressed:(UIGestureRecognizer *)r
372
349
  {
373
- [self sendAppleTVEvent:RCTTVRemoteEventPlayPause];
350
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventPlayPause keyAction:r.eventKeyAction tag:nil target:nil];
374
351
  }
375
352
 
376
353
  - (void)menuPressed:(UIGestureRecognizer *)r
377
354
  {
378
- [self sendAppleTVEvent:RCTTVRemoteEventMenu];
355
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventMenu keyAction:r.eventKeyAction tag:nil target:nil];
379
356
  }
380
357
 
381
358
  - (void)selectPressed:(UIGestureRecognizer *)r
382
359
  {
383
- [self sendAppleTVEvent:RCTTVRemoteEventSelect];
360
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventSelect keyAction:r.eventKeyAction tag:nil target:nil];
384
361
  }
385
362
 
386
363
  - (void)longPlayPausePressed:(UIGestureRecognizer *)r
387
364
  {
388
- [self sendAppleTVEvent:RCTTVRemoteEventLongPlayPause];
365
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongPlayPause keyAction:r.eventKeyAction tag:nil target:nil];
389
366
 
390
367
  #if RCT_DEV
391
- // If shake to show is enabled on device, use long play/pause event to show dev menu
392
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTShowDevMenuNotification" object:nil];
368
+ // If shake to show is enabled on device, use long play/pause event to show dev menu
369
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTShowDevMenuNotification" object:nil];
393
370
  #endif
394
371
  }
395
372
 
396
373
  - (void)longSelectPressed:(UIGestureRecognizer *)r
397
374
  {
398
- [self sendAppleTVEvent:RCTTVRemoteEventLongSelect];
375
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:r.eventKeyAction tag:nil target:nil];
399
376
  }
400
377
 
401
378
  - (void)longUpPressed:(UIGestureRecognizer *)r
402
379
  {
403
- [self sendAppleTVEvent:RCTTVRemoteEventLongUp];
380
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongUp keyAction:r.eventKeyAction tag:nil target:nil];
404
381
  }
405
382
 
406
383
  - (void)longDownPressed:(UIGestureRecognizer *)r
407
384
  {
408
- [self sendAppleTVEvent:RCTTVRemoteEventLongDown];
385
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongDown keyAction:r.eventKeyAction tag:nil target:nil];
409
386
  }
410
387
 
411
388
  - (void)longLeftPressed:(UIGestureRecognizer *)r
412
389
  {
413
- [self sendAppleTVEvent:RCTTVRemoteEventLongLeft];
390
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongLeft keyAction:r.eventKeyAction tag:nil target:nil];
414
391
  }
415
392
 
416
393
  - (void)longRightPressed:(UIGestureRecognizer *)r
417
394
  {
418
- [self sendAppleTVEvent:RCTTVRemoteEventLongRight];
395
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongRight keyAction:r.eventKeyAction tag:nil target:nil];
419
396
  }
420
397
 
421
398
  - (void)swipedUp:(UIGestureRecognizer *)r
422
399
  {
423
- [self sendAppleTVEvent:RCTTVRemoteEventSwipeUp];
400
+ [[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeUp body:r.eventState];
424
401
  }
425
402
 
426
403
  - (void)swipedDown:(UIGestureRecognizer *)r
427
404
  {
428
- [self sendAppleTVEvent:RCTTVRemoteEventSwipeDown];
405
+ [[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeDown body:r.eventState];
429
406
  }
430
407
 
431
408
  - (void)swipedLeft:(UIGestureRecognizer *)r
432
409
  {
433
- [self sendAppleTVEvent:RCTTVRemoteEventSwipeLeft];
410
+ [[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeLeft body:r.eventState];
434
411
  }
435
412
 
436
413
  - (void)swipedRight:(UIGestureRecognizer *)r
437
414
  {
438
- [self sendAppleTVEvent:RCTTVRemoteEventSwipeRight];
415
+ [[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeRight body:r.eventState];
439
416
  }
440
417
 
441
418
  - (void)tappedUp:(UIGestureRecognizer *)r
442
419
  {
443
- [self sendAppleTVEvent:RCTTVRemoteEventUp];
420
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventUp keyAction:r.eventKeyAction tag:nil target:nil];
444
421
  }
445
422
 
446
423
  - (void)tappedDown:(UIGestureRecognizer *)r
447
424
  {
448
- [self sendAppleTVEvent:RCTTVRemoteEventDown];
425
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventDown keyAction:r.eventKeyAction tag:nil target:nil];
449
426
  }
450
427
 
451
428
  - (void)tappedPageUp:(UIGestureRecognizer *)r
452
429
  {
453
- [self sendAppleTVEvent:RCTTVRemoteEventPageUp];
430
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventPageUp keyAction:r.eventKeyAction tag:nil target:nil];
454
431
  }
455
432
 
456
433
  - (void)tappedPageDown:(UIGestureRecognizer *)r
457
434
  {
458
- [self sendAppleTVEvent:RCTTVRemoteEventPageDown];
435
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventPageDown keyAction:r.eventKeyAction tag:nil target:nil];
459
436
  }
460
437
 
461
438
  - (void)tappedLeft:(UIGestureRecognizer *)r
462
439
  {
463
- [self sendAppleTVEvent:RCTTVRemoteEventLeft];
440
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLeft keyAction:r.eventKeyAction tag:nil target:nil];
464
441
  }
465
442
 
466
443
  - (void)tappedRight:(UIGestureRecognizer *)r
467
444
  {
468
- [self sendAppleTVEvent:RCTTVRemoteEventRight];
445
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventRight keyAction:r.eventKeyAction tag:nil target:nil];
469
446
  }
470
447
 
471
448
  - (void)panned:(UIPanGestureRecognizer *)gesture {
472
449
  UIView *rootView = [self view];
473
- NSString *gestureState = [self recognizerStateToString:gesture.state];
450
+ NSMutableDictionary *eventBody= [gesture.eventState mutableCopy];
474
451
  CGPoint translation = [gesture translationInView:rootView];
475
452
  CGPoint velocity = [gesture velocityInView:rootView];
476
453
 
477
- if (gestureState) {
478
- [self sendAppleTVEvent:RCTTVRemoteEventPan withBody:@{@"state": gestureState,
479
- @"x": [NSNumber numberWithInt:translation.x],
480
- @"y": [NSNumber numberWithInt:translation.y],
481
- @"velocityX": [NSNumber numberWithFloat:velocity.x],
482
- @"velocityY": [NSNumber numberWithFloat:velocity.y],
483
- }];
454
+ if (eventBody.count > 0) {
455
+ eventBody[@"x"] = [NSNumber numberWithInt:translation.x];
456
+ eventBody[@"y"] = [NSNumber numberWithInt:translation.y];
457
+ eventBody[@"velocityX"] = [NSNumber numberWithFloat:velocity.x];
458
+ eventBody[@"velocityY"] = [NSNumber numberWithFloat:velocity.y];
459
+
460
+ [[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventPan body:[eventBody copy]];
484
461
  }
485
462
  }
486
463
 
@@ -517,37 +494,4 @@ static __volatile BOOL __gestureHandlersCancelTouches = YES;
517
494
 
518
495
  _tvRemoteGestureRecognizers[name] = recognizer;
519
496
  }
520
-
521
- #pragma mark -
522
- #pragma mark Helper methods
523
-
524
- - (void)sendAppleTVEvent:(NSString *)eventType
525
- {
526
- [self sendAppleTVEvent:eventType withBody: nil];
527
- }
528
-
529
- - (void)sendAppleTVEvent:(NSString *)eventType
530
- withBody:(NSDictionary * __nullable)body
531
- {
532
- NSDictionary *payload = (body != nil) ?
533
- @{@"eventType" : eventType, @"body": body} :
534
- @{@"eventType" : eventType};
535
-
536
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTTVNavigationEventNotification"
537
- object:payload];
538
- }
539
-
540
- - (NSString *)recognizerStateToString:(UIGestureRecognizerState)state {
541
- switch (state) {
542
- case UIGestureRecognizerStateBegan:
543
- return @"Began";
544
- case UIGestureRecognizerStateChanged:
545
- return @"Changed";
546
- case UIGestureRecognizerStateEnded:
547
- return @"Ended";
548
- default:
549
- return nil;
550
- }
551
- }
552
-
553
497
  @end
@@ -0,0 +1,37 @@
1
+ /*
2
+ * This source code is licensed under the MIT license found in the
3
+ * LICENSE file in the root directory of this source tree.
4
+ */
5
+
6
+ #ifndef RCTTVRemoteHandlerConstants_h
7
+ #define RCTTVRemoteHandlerConstants_h
8
+
9
+ typedef NSString *RCTTVRemoteEvent NS_TYPED_ENUM;
10
+
11
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventMenu;
12
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventPlayPause;
13
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventSelect;
14
+
15
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLongPlayPause;
16
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLongSelect;
17
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLongUp;
18
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLongDown;
19
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLongLeft;
20
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLongRight;
21
+
22
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventLeft;
23
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventRight;
24
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventUp;
25
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventDown;
26
+
27
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventPageUp;
28
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventPageDown;
29
+
30
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventSwipeLeft;
31
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventSwipeRight;
32
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventSwipeUp;
33
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventSwipeDown;
34
+
35
+ extern RCTTVRemoteEvent _Nonnull const RCTTVRemoteEventPan;
36
+
37
+ #endif /* RCTTVRemoteHandlerConstants_h */
@@ -0,0 +1,32 @@
1
+ /*
2
+ * This source code is licensed under the MIT license found in the
3
+ * LICENSE file in the root directory of this source tree.
4
+ */
5
+
6
+ #import "RCTTVRemoteHandlerConstants.h"
7
+
8
+ RCTTVRemoteEvent const RCTTVRemoteEventMenu = @"menu";
9
+ RCTTVRemoteEvent const RCTTVRemoteEventPlayPause = @"playPause";
10
+ RCTTVRemoteEvent const RCTTVRemoteEventSelect = @"select";
11
+
12
+ RCTTVRemoteEvent const RCTTVRemoteEventLongPlayPause = @"longPlayPause";
13
+ RCTTVRemoteEvent const RCTTVRemoteEventLongSelect = @"longSelect";
14
+ RCTTVRemoteEvent const RCTTVRemoteEventLongUp = @"longUp";
15
+ RCTTVRemoteEvent const RCTTVRemoteEventLongDown = @"longDown";
16
+ RCTTVRemoteEvent const RCTTVRemoteEventLongLeft = @"longLeft";
17
+ RCTTVRemoteEvent const RCTTVRemoteEventLongRight = @"longRight";
18
+
19
+ RCTTVRemoteEvent const RCTTVRemoteEventLeft = @"left";
20
+ RCTTVRemoteEvent const RCTTVRemoteEventRight = @"right";
21
+ RCTTVRemoteEvent const RCTTVRemoteEventUp = @"up";
22
+ RCTTVRemoteEvent const RCTTVRemoteEventDown = @"down";
23
+
24
+ RCTTVRemoteEvent const RCTTVRemoteEventPageUp = @"pageUp";
25
+ RCTTVRemoteEvent const RCTTVRemoteEventPageDown = @"pageDown";
26
+
27
+ RCTTVRemoteEvent const RCTTVRemoteEventSwipeLeft = @"swipeLeft";
28
+ RCTTVRemoteEvent const RCTTVRemoteEventSwipeRight = @"swipeRight";
29
+ RCTTVRemoteEvent const RCTTVRemoteEventSwipeUp = @"swipeUp";
30
+ RCTTVRemoteEvent const RCTTVRemoteEventSwipeDown = @"swipeDown";
31
+
32
+ RCTTVRemoteEvent const RCTTVRemoteEventPan = @"pan";
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"0rc0",
27
+ RCTVersionPrerelease: @"0rc2",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -10,6 +10,7 @@
10
10
  #import <objc/runtime.h>
11
11
 
12
12
  #import <FBReactNativeSpec/FBReactNativeSpec.h>
13
+ #import <React/RCTBridge+Inspector.h>
13
14
  #import <React/RCTBridge+Private.h>
14
15
  #import <React/RCTBridgeModule.h>
15
16
  #import <React/RCTConstants.h>
@@ -57,11 +57,6 @@ RCT_EXPORT_MODULE()
57
57
  #if !TARGET_OS_TV
58
58
  _currentInterfaceOrientation = [RCTSharedApplication() statusBarOrientation];
59
59
 
60
- [[NSNotificationCenter defaultCenter] addObserver:self
61
- selector:@selector(interfaceOrientationDidChange)
62
- name:UIApplicationDidChangeStatusBarOrientationNotification
63
- object:nil];
64
-
65
60
  _currentInterfaceDimensions = [self _exportedDimensions];
66
61
 
67
62
  [[NSNotificationCenter defaultCenter] addObserver:self
@@ -78,6 +73,11 @@ RCT_EXPORT_MODULE()
78
73
  selector:@selector(interfaceFrameDidChange)
79
74
  name:RCTWindowFrameDidChangeNotification
80
75
  object:nil];
76
+ [[NSNotificationCenter defaultCenter] addObserver:self
77
+ selector:@selector(interfaceFrameDidChange)
78
+ name:UIDeviceOrientationDidChangeNotification
79
+ object:nil];
80
+ #endif
81
81
 
82
82
  // TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73
83
83
  // The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure
@@ -89,11 +89,13 @@ RCT_EXPORT_MODULE()
89
89
  name:RCTBridgeWillInvalidateModulesNotification
90
90
  object:nil];
91
91
 
92
- #endif
93
92
  }
94
93
 
95
94
  - (void)invalidate
96
95
  {
96
+ if (_invalidated) {
97
+ return;
98
+ }
97
99
  _invalidated = YES;
98
100
  [self _cleanupObservers];
99
101
  }
@@ -103,21 +105,18 @@ RCT_EXPORT_MODULE()
103
105
  [[NSNotificationCenter defaultCenter] removeObserver:self
104
106
  name:RCTAccessibilityManagerDidUpdateMultiplierNotification
105
107
  object:[_moduleRegistry moduleForName:"AccessibilityManager"]];
106
- #if !TARGET_OS_TV
107
- [[NSNotificationCenter defaultCenter] removeObserver:self
108
- name:UIApplicationDidChangeStatusBarOrientationNotification
109
- object:nil];
110
- #endif
108
+
111
109
  [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
112
110
 
113
- [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTUserInterfaceStyleDidChangeNotification object:nil];
111
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
114
112
 
113
+ #if !TARGET_OS_TV
115
114
  [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTWindowFrameDidChangeNotification object:nil];
116
115
 
117
- [[NSNotificationCenter defaultCenter] addObserver:self
118
- selector:@selector(invalidate)
119
- name:RCTBridgeWillInvalidateModulesNotification
120
- object:nil];
116
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTUserInterfaceStyleDidChangeNotification object:nil];
117
+
118
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
119
+ #endif
121
120
  }
122
121
 
123
122
  static BOOL RCTIsIPhoneNotched()
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #import "RCTTVNavigationEventEmitter.h"
9
+ #import "RCTTVNavigationEventNotificationConstants.h"
9
10
 
10
11
  #import <FBReactNativeSpec/FBReactNativeSpec.h>
11
12
  #import "CoreModulesPlugins.h"
@@ -29,7 +30,7 @@ RCT_EXPORT_MODULE()
29
30
  if (self = [super init]) {
30
31
  [[NSNotificationCenter defaultCenter] addObserver:self
31
32
  selector:@selector(handleTVNavigationEventNotification:)
32
- name:@"RCTTVNavigationEventNotification"
33
+ name:RCTTVNavigationEventNotificationName
33
34
  object:nil];
34
35
  }
35
36
  return self;
@@ -9,6 +9,7 @@
9
9
  #include <future>
10
10
 
11
11
  #import <React/RCTAssert.h>
12
+ #import <React/RCTBridge+Inspector.h>
12
13
  #import <React/RCTBridge+Private.h>
13
14
  #import <React/RCTBridge.h>
14
15
  #import <React/RCTBridgeMethod.h>
@@ -11,6 +11,7 @@
11
11
  #import <React/RCTBridge+Private.h>
12
12
  #import <React/RCTConstants.h>
13
13
  #import <React/RCTScrollEvent.h>
14
+ #import <React/RCTTVNavigationEventNotification.h>
14
15
 
15
16
  #import <react/renderer/components/scrollview/RCTComponentViewHelpers.h>
16
17
  #import <react/renderer/components/scrollview/ScrollViewComponentDescriptor.h>
@@ -865,22 +866,22 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
865
866
  {
866
867
  [[NSNotificationCenter defaultCenter] addObserver:self
867
868
  selector:@selector(handleTVNavigationEventNotification:)
868
- name:@"RCTTVNavigationEventNotification"
869
+ name:RCTTVNavigationEventNotificationName
869
870
  object:nil];
870
871
  }
871
872
 
872
873
  - (void)removeArrowsListeners
873
874
  {
874
875
  [[NSNotificationCenter defaultCenter] removeObserver:self
875
- name:@"RCTTVNavigationEventNotification"
876
+ name:RCTTVNavigationEventNotificationName
876
877
  object:nil];
877
878
  }
878
879
 
879
880
  - (void)handleTVNavigationEventNotification:(NSNotification *)notif
880
881
  {
881
- NSArray *supportedEvents = [NSArray arrayWithObjects:@"up", @"down", @"left", @"right", nil];
882
+ NSArray *supportedEvents = @[RCTTVRemoteEventUp, RCTTVRemoteEventDown, RCTTVRemoteEventLeft, RCTTVRemoteEventRight];
882
883
 
883
- if (notif.object == nil || notif.object[@"eventType"] == nil || ![supportedEvents containsObject:notif.object[@"eventType"]] ) {
884
+ if (notif.object == nil || notif.object[RCTTVNavigationEventNotificationKeyEventType] == nil || ![supportedEvents containsObject:notif.object[RCTTVNavigationEventNotificationKeyEventType]] ) {
884
885
  return;
885
886
  }
886
887
 
@@ -891,23 +892,23 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
891
892
 
892
893
  BOOL isHorizontal = _scrollView.contentSize.width > self.frame.size.width;
893
894
  if (!isHorizontal) {
894
- if ([notif.object[@"eventType"] isEqual: @"down"]) {
895
+ if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventDown]) {
895
896
  [self swipedDown];
896
897
  return;
897
898
  }
898
899
 
899
- if ([notif.object[@"eventType"] isEqual: @"up"]) {
900
+ if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventUp]) {
900
901
  [self swipedUp];
901
902
  return;
902
903
  }
903
904
  }
904
905
 
905
- if ([notif.object[@"eventType"] isEqual: @"left"]) {
906
+ if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventLeft]) {
906
907
  [self swipedLeft];
907
908
  return;
908
909
  }
909
910
 
910
- if ([notif.object[@"eventType"] isEqual: @"right"]) {
911
+ if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventRight]) {
911
912
  [self swipedRight];
912
913
  return;
913
914
  }
@@ -936,14 +937,12 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
936
937
 
937
938
  - (void)sendFocusNotification
938
939
  {
939
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTTVNavigationEventNotification"
940
- object:@{ @"eventType": @"focus", @"tag": @([self tag]) }];
940
+ [[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:@(self.tag) target:nil];
941
941
  }
942
942
 
943
943
  - (void)sendBlurNotification
944
944
  {
945
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTTVNavigationEventNotification"
946
- object:@{ @"eventType": @"blur", @"tag": @([self tag]) }];
945
+ [[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:@(self.tag) target:nil];
947
946
  }
948
947
 
949
948
  - (NSInteger)swipeVerticalInterval
@@ -19,6 +19,7 @@
19
19
  #import <React/RCTLog.h>
20
20
 
21
21
  #import <React/RCTSurfaceHostingProxyRootView.h>
22
+ #import <React/RCTTVNavigationEventNotification.h>
22
23
 
23
24
  #import <react/renderer/components/view/ViewComponentDescriptor.h>
24
25
  #import <react/renderer/components/view/ViewEventEmitter.h>
@@ -245,35 +246,25 @@ using namespace facebook::react;
245
246
 
246
247
  - (void)sendFocusNotification:(__unused UIFocusUpdateContext *)context
247
248
  {
248
- [self sendNotificationWithEventType:@"focus"];
249
+ [[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:@(self.tag) target:@(self.tag)];
249
250
  }
250
251
 
251
252
  - (void)sendBlurNotification:(__unused UIFocusUpdateContext *)context
252
253
  {
253
- [self sendNotificationWithEventType:@"blur"];
254
+ [[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:@(self.tag) target:@(self.tag)];
254
255
  }
255
256
 
256
257
  - (void)sendSelectNotification:(UIGestureRecognizer *)recognizer
257
258
  {
258
- [self sendNotificationWithEventType:@"select"];
259
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventSelect keyAction:RCTTVRemoteEventKeyActionUp tag:@(self.tag) target:@(self.tag)];
259
260
  }
260
261
 
261
262
  - (void)sendLongSelectNotification:(UIGestureRecognizer *)recognizer
262
263
  {
263
- [self sendNotificationWithEventType:@"longSelect"];
264
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:recognizer.eventKeyAction tag:@(self.tag) target:@(self.tag)];
264
265
  }
265
266
 
266
- - (void)sendNotificationWithEventType:(NSString * __nonnull)eventType
267
- {
268
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTTVNavigationEventNotification"
269
- object:@{
270
- @"eventType":eventType,
271
- @"tag":@([self tag]),
272
- @"target":@([self tag])
273
- }];
274
- }
275
-
276
- - (void)handleSelect:(__unused UIGestureRecognizer *)r
267
+ - (void)handleSelect:(UIGestureRecognizer *)r
277
268
  {
278
269
  if (_tvParallaxProperties.enabled == YES) {
279
270
  float magnification = _tvParallaxProperties.magnification;
@@ -308,9 +299,7 @@ using namespace facebook::react;
308
299
 
309
300
  - (void)handleLongSelect:(UIGestureRecognizer *)r
310
301
  {
311
- if (r.state == UIGestureRecognizerStateBegan) {
312
302
  [self sendLongSelectNotification:r];
313
- }
314
303
  }
315
304
 
316
305
  - (void)addParallaxMotionEffects
@@ -788,5 +788,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)act
788
788
  }
789
789
  }
790
790
  }
791
+ #endif
791
792
 
792
793
  @end
@@ -1684,6 +1684,16 @@ static UIView *_jsResponder;
1684
1684
  return self;
1685
1685
  }
1686
1686
 
1687
+ - (NSUInteger)count
1688
+ {
1689
+ return self->_registry.count;
1690
+ }
1691
+
1692
+ - (NSEnumerator *)keyEnumerator
1693
+ {
1694
+ return self->_registry.keyEnumerator;
1695
+ }
1696
+
1687
1697
  - (id)objectForKey:(id)key
1688
1698
  {
1689
1699
  if (![key isKindOfClass:[NSNumber class]]) {
@@ -18,6 +18,7 @@
18
18
  #import "RCTView.h"
19
19
  #import "UIView+React.h"
20
20
  #import <React/RCTUIManager.h>
21
+ #import <React/RCTTVNavigationEventNotification.h>
21
22
 
22
23
  @implementation RCTTVView {
23
24
  __weak RCTBridge *_bridge;
@@ -98,7 +99,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
98
99
  }
99
100
  }
100
101
 
101
- - (void)handleSelect:(__unused UIGestureRecognizer *)r
102
+ - (void)handleSelect:(UIGestureRecognizer *)r
102
103
  {
103
104
  if ([self.tvParallaxProperties[@"enabled"] boolValue] == YES) {
104
105
  float magnification = [self.tvParallaxProperties[@"magnification"] floatValue];
@@ -133,9 +134,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
133
134
 
134
135
  - (void)handleLongSelect:(UIGestureRecognizer *)r
135
136
  {
136
- if (r.state == UIGestureRecognizerStateBegan) {
137
137
  [self sendLongSelectNotification:r];
138
- }
139
138
  }
140
139
 
141
140
  - (BOOL)isTVFocusGuide
@@ -434,32 +433,22 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
434
433
 
435
434
  - (void)sendFocusNotification:(__unused UIFocusUpdateContext *)context
436
435
  {
437
- [self sendNotificationWithEventType:@"focus"];
436
+ [[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:self.reactTag target:self.reactTag];
438
437
  }
439
438
 
440
439
  - (void)sendBlurNotification:(__unused UIFocusUpdateContext *)context
441
440
  {
442
- [self sendNotificationWithEventType:@"blur"];
441
+ [[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:self.reactTag target:self.reactTag];
443
442
  }
444
443
 
445
444
  - (void)sendSelectNotification:(UIGestureRecognizer *)recognizer
446
445
  {
447
- [self sendNotificationWithEventType:@"select"];
446
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventSelect keyAction:RCTTVRemoteEventKeyActionUp tag:self.reactTag target:self.reactTag];
448
447
  }
449
448
 
450
449
  - (void)sendLongSelectNotification:(UIGestureRecognizer *)recognizer
451
450
  {
452
- [self sendNotificationWithEventType:@"longSelect"];
453
- }
454
-
455
- - (void)sendNotificationWithEventType:(NSString * __nonnull)eventType
456
- {
457
- [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTTVNavigationEventNotification"
458
- object:@{
459
- @"eventType":eventType,
460
- @"tag":self.reactTag,
461
- @"target":self.reactTag
462
- }];
451
+ [[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:recognizer.eventKeyAction tag:self.reactTag target:self.reactTag];
463
452
  }
464
453
 
465
454
  - (RCTTVView *)getViewById:(NSNumber *)viewId {