From 09137a92987643513dab051c09c5dc7d915f55ef Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Tue, 3 Jan 2023 15:06:30 -0600 Subject: [PATCH] Update RCTView.m --- React/Views/RCTView.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index 64e6fe0a2f07a2..7bb6262700c7d9 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -1675,13 +1675,6 @@ - (RCTViewKeyboardEvent*)keyboardEvent:(NSEvent*)event { return [RCTViewKeyboardEvent keyEventFromEvent:event reactTag:self.reactTag]; } -// If validKeysUp or validKeysDown is defined, use the legacy keyboard event handling behavior -- (void)shouldUseLegacyKeyboardBehaviorForEvent:(NSEvent*)event { - BOOL keyDown = event.type == NSEventTypeKeyDown; - NSArray *validKeys = keyDown ? [self validKeysDown] : [self validKeysUp]; - return (validKeys == nil); -} - // Only send events to JS that are defined in validKeysDown. Bubbling happens only natively - (BOOL)handleKeyboardEventLegacy:(NSEvent *)event { if (event.type == NSEventTypeKeyDown ? self.onKeyDown : self.onKeyUp) { @@ -1718,6 +1711,13 @@ - (BOOL)handleKeyboardEventModern:(NSEvent*)event { return shouldSuppressNativeHandling; } +// If validKeysUp or validKeysDown is defined, use the legacy keyboard event handling behavior +- (void)shouldUseLegacyKeyboardBehaviorForEvent:(NSEvent*)event { + BOOL keyDown = event.type == NSEventTypeKeyDown; + NSArray *validKeys = keyDown ? [self validKeysDown] : [self validKeysUp]; + return (validKeys == nil); +} + - (void)keyDown:(NSEvent *)event { BOOL shouldUseLegacyBehavior = [self shouldUseLegacyKeyboardBehaviorForEvent:event];