Skip to content

Commit

Permalink
Fix bugs with multiline TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
lyahdav committed Oct 23, 2020
1 parent 9c727d8 commit 1cd7a3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ - (void)setReactBorderInsets:(UIEdgeInsets)reactBorderInsets
{
[super setReactBorderInsets:reactBorderInsets];
// We apply `borderInsets` as `_scrollView` layout offset on mac.
_scrollView.frame = UIEdgeInsetsInsetRect(self.frame, reactBorderInsets);
_scrollView.frame = UIEdgeInsetsInsetRect(self.bounds, reactBorderInsets);
[self setNeedsLayout];
}
#endif // ]TODO(macOS ISS#2323203)
Expand Down
7 changes: 7 additions & 0 deletions Libraries/Text/TextInput/Multiline/RCTUITextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ - (instancetype)initWithFrame:(CGRect)frame
self.backgroundColor = [RCTUIColor clearColor]; // TODO(macOS ISS#2323203)
self.textColor = [RCTUIColor blackColor]; // TODO(macOS ISS#2323203)
// This line actually removes 5pt (default value) left and right padding in UITextView.
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
self.textContainer.lineFragmentPadding = 0;
#else
// macOS has a bug where setting this to 0 will cause the scroll view to scroll to top when
// inserting a newline at the bottom of a NSTextView when it has more rows than can be displayed
// on screen.
self.textContainer.lineFragmentPadding = 1;
#endif
#if !TARGET_OS_OSX && !TARGET_OS_TV // TODO(macOS ISS#2323203)
self.scrollsToTop = NO;
#endif
Expand Down

0 comments on commit 1cd7a3d

Please sign in to comment.