Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions React/Base/RCTTVRemoteHandler.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,9 @@
#import "RCTView.h"
#import "UIView+React.h"

#if __has_include("RCTDevMenu.h")
#import "RCTDevMenu.h"
#endif

@implementation RCTTVRemoteHandler {
NSMutableArray<UIGestureRecognizer *> *_tvRemoteGestureRecognizers;
Expand DownExpand Up@@ -62,13 +64,13 @@ - (instancetype)init
// Right
[self addTapGestureRecognizerWithSelector:@selector(swipedRight:)
pressType:UIPressTypeRightArrow];

// Recognizers for long button presses
// We don't intercept long menu press -- that's used by the system to go to the home screen

[self addLongPressGestureRecognizerWithSelector:@selector(longPlayPausePressed:)
pressType:UIPressTypePlayPause];

[self addLongPressGestureRecognizerWithSelector:@selector(longSelectPressed:)
pressType:UIPressTypeSelect];

Expand DownExpand Up@@ -114,8 +116,8 @@ - (void)longPlayPausePressed:(UIGestureRecognizer *)r
{
[self sendAppleTVEvent:@"longPlayPause" toView:r.view];

#if __has_include("RCTDevMenu.h") && RCT_DEV
// If shake to show is enabled on device, use long play/pause event to show dev menu
#if RCT_DEV
[[NSNotificationCenter defaultCenter] postNotificationName:RCTShowDevMenuNotification object:nil];
#endif
}
Expand DownExpand Up@@ -151,7 +153,7 @@ - (void)addLongPressGestureRecognizerWithSelector:(nonnull SEL)selector pressTyp
{
UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:selector];
recognizer.allowedPressTypes = @[@(pressType)];

[_tvRemoteGestureRecognizers addObject:recognizer];
}

Expand Down