Skip to content

Commit

Permalink
style(fabric, textinput): dont' nil check the window before calling f…
Browse files Browse the repository at this point in the history
…ocus / blur
  • Loading branch information
Saadnajmi committed Nov 20, 2024
1 parent edbec15 commit 2b7bbcf
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,8 @@ - (void)focus
#if !TARGET_OS_OSX // [macOS]
[_backedTextInputView becomeFirstResponder];
#else // [macOS
NSWindow *window = _backedTextInputView.window;
if (window) {
[window makeFirstResponder:_backedTextInputView];
}
NSWindow *window = [_backedTextInputView window];
[window makeFirstResponder:_backedTextInputView];
#endif // macOS]

const auto &props = static_cast<const TextInputProps &>(*_props);
Expand All @@ -555,12 +553,9 @@ - (void)blur
#if !TARGET_OS_OSX // [macOS]
[_backedTextInputView resignFirstResponder];
#else // [macOS
NSWindow *window = _backedTextInputView.window;
if (window && window.firstResponder == _backedTextInputView) {
// Calling makeFirstResponder with nil will call resignFirstResponder and make the window the first responder
[window makeFirstResponder:nil];
}
#endif // macOS];
NSWindow *window = [_backedTextInputView window];
[window makeFirstResponder:nil];
#endif // macOS]
}

- (void)setTextAndSelection:(NSInteger)eventCount
Expand Down

0 comments on commit 2b7bbcf

Please sign in to comment.