@@ -34,6 +34,7 @@ @implementation RCTTextView
34
34
NSString *_placeholder;
35
35
TextViewWithPlaceHolder *_textView;
36
36
NSInteger _nativeEventCount;
37
+ CGFloat _padding;
37
38
}
38
39
39
40
- (instancetype )initWithEventDispatcher : (RCTEventDispatcher *)eventDispatcher
@@ -49,6 +50,7 @@ - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
49
50
// _textView.scrollsToTop = NO;
50
51
_jsRequestingFirstResponder = YES ;
51
52
_textView.delegate = self;
53
+ _padding = 0 ;
52
54
[self addSubview: _textView];
53
55
}
54
56
return self;
@@ -66,22 +68,24 @@ - (void)updateFrames
66
68
// We apply the left inset to the frame since a negative left text-container
67
69
// inset mysteriously causes the text to be hidden until the text view is
68
70
// first focused.
69
- NSEdgeInsets adjustedFrameInset = NSEdgeInsetsZero ;
70
- adjustedFrameInset.left = _contentInset.left - 5 ;
71
-
72
- NSEdgeInsets adjustedTextContainerInset = _contentInset;
73
- adjustedTextContainerInset.top += 5 ;
74
- adjustedTextContainerInset.left = 0 ;
75
-
71
+ // NSEdgeInsets adjustedFrameInset = NSEdgeInsetsZero;
72
+ // adjustedFrameInset.left = _contentInset.left - 5;
73
+ //
74
+ // NSEdgeInsets adjustedTextContainerInset = _contentInset;
75
+ // adjustedTextContainerInset.top += 5;
76
+ // adjustedTextContainerInset.left = 0;
77
+ //
76
78
CGRect frame = self.frame ;// TODO: UIEdgeInsetsInsetRect(self.bounds, adjustedFrameInset);
77
79
_textView.frame = frame;
78
80
79
81
// TODO:
80
- // _textView.textContainerInset = adjustedTextContainerInset;
81
- // _placeholderView.textContainerInset = adjustedTextContainerInset;
82
+ [_textView setTextContainerInset: CGSizeMake (_padding, _padding)];
83
+ // _textView.textContainerInset = adjustedTextContainerInset;
84
+
82
85
}
83
86
84
87
88
+
85
89
- (void )updatePlaceholder
86
90
{
87
91
if (_placeholder) {
@@ -132,6 +136,13 @@ - (void)setPlaceholderTextColor:(NSColor *)placeholderTextColor
132
136
[self updatePlaceholder ];
133
137
}
134
138
139
+ - (void )setPadding : (CGFloat )padding
140
+ {
141
+ // NSLog(@"padding %@", padding);
142
+ _padding = padding;
143
+ [self updateFrames ];
144
+ }
145
+
135
146
- (void )setContentInset : (NSEdgeInsets )contentInset
136
147
{
137
148
_contentInset = contentInset;
0 commit comments