@@ -15,6 +15,7 @@ @implementation RCTMultilineTextInputView
15
15
{
16
16
#if TARGET_OS_OSX // [TODO(macOS GH#774)
17
17
RCTUIScrollView *_scrollView;
18
+ RCTClipView *_clipView;
18
19
#endif // ]TODO(macOS GH#774)
19
20
RCTUITextView *_backedTextInputView;
20
21
}
@@ -38,6 +39,9 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
38
39
_scrollView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
39
40
[_scrollView setHasVerticalScroller: YES ];
40
41
42
+ _clipView = [[RCTClipView alloc ] initWithFrame: _scrollView.frame];
43
+ [_scrollView setContentView: _clipView];
44
+
41
45
_backedTextInputView.verticallyResizable = YES ;
42
46
_backedTextInputView.horizontallyResizable = YES ;
43
47
_backedTextInputView.textContainer .containerSize = NSMakeSize (CGFLOAT_MAX, CGFLOAT_MAX);
@@ -94,17 +98,35 @@ - (void)setReactBorderInsets:(UIEdgeInsets)reactBorderInsets
94
98
[self setNeedsLayout ];
95
99
}
96
100
97
- - (void )setEnableFocusRing : (BOOL )enableFocusRing {
101
+ - (void )setEnableFocusRing : (BOOL )enableFocusRing
102
+ {
98
103
[super setEnableFocusRing: enableFocusRing];
99
104
if ([_scrollView respondsToSelector: @selector (setEnableFocusRing: )]) {
100
105
[_scrollView setEnableFocusRing: enableFocusRing];
101
106
}
102
107
}
103
108
104
- - (void )setReadablePasteBoardTypes : (NSArray <NSPasteboardType> *)readablePasteboardTypes {
109
+ - (void )setReadablePasteBoardTypes : (NSArray <NSPasteboardType> *)readablePasteboardTypes
110
+ {
105
111
[_backedTextInputView setReadablePasteBoardTypes: readablePasteboardTypes];
106
112
}
107
113
114
+ - (void )setScrollEnabled : (BOOL )scrollEnabled
115
+ {
116
+ if (scrollEnabled) {
117
+ _scrollView.scrollEnabled = YES ;
118
+ [_clipView setConstrainScrolling: NO ];
119
+ } else {
120
+ _scrollView.scrollEnabled = NO ;
121
+ [_clipView setConstrainScrolling: YES ];
122
+ }
123
+ }
124
+
125
+ - (BOOL )scrollEnabled
126
+ {
127
+ return _scrollView.isScrollEnabled ;
128
+ }
129
+
108
130
- (BOOL )shouldShowVerticalScrollbar
109
131
{
110
132
// Hide vertical scrollbar if explicity set to NO
0 commit comments