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.
- package/Libraries/AppDelegate/RCTAppDelegate.mm +10 -5
- package/Libraries/AppDelegate/RCTRootViewFactory.h +13 -3
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +25 -10
- package/Libraries/Components/Pressable/Pressable.js +9 -13
- package/Libraries/Components/Touchable/TVTouchable.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +2 -2
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableOpacity.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Pressability/Pressability.js +5 -0
- package/Libraries/ReactNative/AppContainer-dev.js +21 -2
- package/React/Base/RCTBridge+Inspector.h +30 -0
- package/React/Base/RCTBridge+Private.h +0 -20
- package/React/Base/RCTBridge.mm +1 -0
- package/React/Base/RCTBridgeProxy.h +6 -1
- package/React/Base/RCTBridgeProxy.mm +4 -2
- package/React/Base/RCTTVNavigationEventNotification.h +37 -0
- package/React/Base/RCTTVNavigationEventNotification.mm +106 -0
- package/React/Base/RCTTVNavigationEventNotificationConstants.h +25 -0
- package/React/Base/RCTTVNavigationEventNotificationConstants.mm +18 -0
- package/React/Base/RCTTVRemoteHandler.h +0 -26
- package/React/Base/RCTTVRemoteHandler.m +34 -90
- package/React/Base/RCTTVRemoteHandlerConstants.h +37 -0
- package/React/Base/RCTTVRemoteHandlerConstants.mm +32 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevSettings.mm +1 -0
- package/React/CoreModules/RCTDeviceInfo.mm +15 -16
- package/React/CoreModules/RCTTVNavigationEventEmitter.mm +2 -1
- package/React/CxxBridge/RCTCxxBridge.mm +1 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +11 -12
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +6 -17
- package/React/Fabric/RCTSurfacePointerHandler.mm +1 -0
- package/React/Modules/RCTUIManager.m +10 -0
- package/React/Views/RCTTVView.m +6 -17
- package/React/Views/ScrollView/RCTScrollView.m +11 -12
- package/ReactAndroid/api/ReactAndroid.api +25 -1
- package/ReactAndroid/build.gradle.kts +18 -6
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +14 -36
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +106 -9
- package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +12 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +64 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +4 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +1 -1
- package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
- package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +0 -1
- package/ReactCommon/react/runtime/iostests/RCTHostTests.mm +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h +0 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +10 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +32 -9
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +6 -12
- package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.h +1 -1
- package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.mm +3 -2
- package/ReactCommon/yoga/Yoga.podspec +4 -1
- package/package.json +22 -14
- package/scripts/cocoapods/helpers.rb +4 -0
- package/scripts/cocoapods/utils.rb +27 -7
- package/scripts/react_native_pods.rb +2 -0
- package/scripts/xcode/ccache-clang++.sh +14 -0
- package/scripts/xcode/ccache-clang.sh +14 -0
- package/scripts/xcode/ccache.conf +11 -0
- package/sdks/hermes-engine/utils/build-ios-framework.sh +5 -0
- package/sdks/hermes-engine/utils/build-mac-framework.sh +5 -0
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/ios/HelloWorld/PrivacyInfo.xcprivacy +38 -0
- package/template/package.json +6 -6
- package/third-party-podspecs/RCT-Folly.podspec +2 -2
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
365
|
+
[[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongPlayPause keyAction:r.eventKeyAction tag:nil target:nil];
|
|
389
366
|
|
|
390
367
|
#if RCT_DEV
|
|
391
|
-
|
|
392
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
400
|
+
[[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeUp body:r.eventState];
|
|
424
401
|
}
|
|
425
402
|
|
|
426
403
|
- (void)swipedDown:(UIGestureRecognizer *)r
|
|
427
404
|
{
|
|
428
|
-
|
|
405
|
+
[[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeDown body:r.eventState];
|
|
429
406
|
}
|
|
430
407
|
|
|
431
408
|
- (void)swipedLeft:(UIGestureRecognizer *)r
|
|
432
409
|
{
|
|
433
|
-
|
|
410
|
+
[[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeLeft body:r.eventState];
|
|
434
411
|
}
|
|
435
412
|
|
|
436
413
|
- (void)swipedRight:(UIGestureRecognizer *)r
|
|
437
414
|
{
|
|
438
|
-
|
|
415
|
+
[[NSNotificationCenter defaultCenter] postNavigationTouchEventWithType:RCTTVRemoteEventSwipeRight body:r.eventState];
|
|
439
416
|
}
|
|
440
417
|
|
|
441
418
|
- (void)tappedUp:(UIGestureRecognizer *)r
|
|
442
419
|
{
|
|
443
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
450
|
+
NSMutableDictionary *eventBody= [gesture.eventState mutableCopy];
|
|
474
451
|
CGPoint translation = [gesture translationInView:rootView];
|
|
475
452
|
CGPoint velocity = [gesture velocityInView:rootView];
|
|
476
453
|
|
|
477
|
-
if (
|
|
478
|
-
[
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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";
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
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]
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
|
33
|
+
name:RCTTVNavigationEventNotificationName
|
|
33
34
|
object:nil];
|
|
34
35
|
}
|
|
35
36
|
return self;
|
|
@@ -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
|
|
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
|
|
876
|
+
name:RCTTVNavigationEventNotificationName
|
|
876
877
|
object:nil];
|
|
877
878
|
}
|
|
878
879
|
|
|
879
880
|
- (void)handleTVNavigationEventNotification:(NSNotification *)notif
|
|
880
881
|
{
|
|
881
|
-
NSArray *supportedEvents = [
|
|
882
|
+
NSArray *supportedEvents = @[RCTTVRemoteEventUp, RCTTVRemoteEventDown, RCTTVRemoteEventLeft, RCTTVRemoteEventRight];
|
|
882
883
|
|
|
883
|
-
if (notif.object == nil || notif.object[
|
|
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[
|
|
895
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventDown]) {
|
|
895
896
|
[self swipedDown];
|
|
896
897
|
return;
|
|
897
898
|
}
|
|
898
899
|
|
|
899
|
-
if ([notif.object[
|
|
900
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventUp]) {
|
|
900
901
|
[self swipedUp];
|
|
901
902
|
return;
|
|
902
903
|
}
|
|
903
904
|
}
|
|
904
905
|
|
|
905
|
-
if ([notif.object[
|
|
906
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventLeft]) {
|
|
906
907
|
[self swipedLeft];
|
|
907
908
|
return;
|
|
908
909
|
}
|
|
909
910
|
|
|
910
|
-
if ([notif.object[
|
|
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]
|
|
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]
|
|
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
|
|
249
|
+
[[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:@(self.tag) target:@(self.tag)];
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
- (void)sendBlurNotification:(__unused UIFocusUpdateContext *)context
|
|
252
253
|
{
|
|
253
|
-
[self
|
|
254
|
+
[[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:@(self.tag) target:@(self.tag)];
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
- (void)sendSelectNotification:(UIGestureRecognizer *)recognizer
|
|
257
258
|
{
|
|
258
|
-
[self
|
|
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
|
-
|
|
264
|
+
[[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventLongSelect keyAction:recognizer.eventKeyAction tag:@(self.tag) target:@(self.tag)];
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
- (void)
|
|
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
|
|
@@ -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]]) {
|
package/React/Views/RCTTVView.m
CHANGED
|
@@ -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:(
|
|
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
|
|
436
|
+
[[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:self.reactTag target:self.reactTag];
|
|
438
437
|
}
|
|
439
438
|
|
|
440
439
|
- (void)sendBlurNotification:(__unused UIFocusUpdateContext *)context
|
|
441
440
|
{
|
|
442
|
-
[self
|
|
441
|
+
[[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:self.reactTag target:self.reactTag];
|
|
443
442
|
}
|
|
444
443
|
|
|
445
444
|
- (void)sendSelectNotification:(UIGestureRecognizer *)recognizer
|
|
446
445
|
{
|
|
447
|
-
[self
|
|
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
|
|
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 {
|