Skip to content

Commit

Permalink
Limit changes to macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Gleitman committed Aug 16, 2024
1 parent 35f61ff commit 2544d67
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ @implementation RCTBaseTextInputView {
BOOL _hasInputAccessoryView;
// [macOS] remove explicit _predictedText ivar declaration
BOOL _didMoveToWindow;
BOOL _isCurrentlyEditing; // [macOS] avoids duplicating effects of textInputDid(Begin|End)Editing calls
#if TARGET_OS_OSX // [macOS avoids duplicating effects of textInputDid(Begin|End)Editing calls
BOOL _isCurrentlyEditing;
#endif // macOS]
}

#if !TARGET_OS_OSX // [macOS]
Expand Down Expand Up @@ -72,7 +74,9 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // [macOS]
_bridge = bridge;
_eventDispatcher = bridge.eventDispatcher;
_isCurrentlyEditing = NO; // [macOS]
#if TARGET_OS_OSX // [macOS
_isCurrentlyEditing = NO;
#endif // macOS]
}

return self;
Expand Down Expand Up @@ -448,12 +452,12 @@ - (BOOL)textInputShouldBeginEditing

- (void)textInputDidBeginEditing
{
// [macOS consolidate duplicate callbacks
#if TARGET_OS_OSX // [macOS consolidate duplicate callbacks
if (_isCurrentlyEditing) {
return;
}
_isCurrentlyEditing = YES;
// macOS]
#endif // macOS]

if (_clearTextOnFocus) {
self.backedTextInputView.attributedText = [NSAttributedString new];
Expand Down Expand Up @@ -483,12 +487,12 @@ - (BOOL)textInputShouldEndEditing

- (void)textInputDidEndEditing
{
// [macOS consolidate duplicate callbacks
#if TARGET_OS_OSX // [macOS consolidate duplicate callbacks
if (!_isCurrentlyEditing) {
return;
}
_isCurrentlyEditing = NO;
// macOS]
#endif // macOS]

self.ghostText = nil; // [macOS]

Expand Down

0 comments on commit 2544d67

Please sign in to comment.