Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,13 @@ - (void)setTextContainerInset:(UIEdgeInsets)textContainerInset
[self setNeedsLayout];
#else // [macOS
((RCTUITextFieldCell*)self.cell).textContainerInset = _textContainerInset;
[self _relocateFieldEditor];
#endif // macOS]
}

#if TARGET_OS_OSX // [macOS
- (void)_relocateFieldEditor
{
if (self.currentEditor) {
NSRange selectedRange = self.currentEditor.selectedRange;

Expand All @@ -213,9 +219,20 @@ - (void)setTextContainerInset:(UIEdgeInsets)textContainerInset
start:selectedRange.location
length:selectedRange.length];
}
#endif // macOS]
}

- (void)setFrameSize:(NSSize)newSize
{
BOOL sizeChanged = !NSEqualSizes(newSize, self.frame.size);
[super setFrameSize:newSize];
// NSTextField resizes the field editor of a field being edited to the cell's drawing rect, which
// leaves out the title rect's padding and vertical centering, so the text jumped to the top.
if (sizeChanged) {
[self _relocateFieldEditor];
}
}
#endif // macOS]

#if TARGET_OS_OSX // [macOS

- (NSResponder *)responder
Expand Down