mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Hook up focus/blur events (#53827)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53827 Hook up focus/blur events to view. Changelog: [Internal] Reviewed By: rozele Differential Revision: D82146291 fbshipit-source-id: 3cb90d22c00d067099c4c6fac734f27030d87639
This commit is contained in:
committed by
Facebook GitHub Bot
parent
07b5802ee5
commit
2945fa6e0e
+28
@@ -1568,6 +1568,34 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
|
||||
[self resignFirstResponder];
|
||||
}
|
||||
|
||||
#pragma mark - Focus Events
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
if (![super becomeFirstResponder]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (_eventEmitter && ReactNativeFeatureFlags::enableImperativeFocus()) {
|
||||
_eventEmitter->onFocus();
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
if (![super resignFirstResponder]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (_eventEmitter && ReactNativeFeatureFlags::enableImperativeFocus()) {
|
||||
_eventEmitter->onBlur();
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user