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];