Skip to content

Commit 46d95af

Browse files
committed
fix: ios fix for padding and verticalAlignment
1 parent b2110ec commit 46d95af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/label.ios.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export class Label extends LabelBase {
227227
updateVerticalAlignment() {
228228
const tv = this.nativeTextViewProtected;
229229
const inset = this.nativeViewProtected.textContainerInset;
230-
const top = layout.toDeviceIndependentPixels(this.effectivePaddingTop + this.effectiveBorderTopWidth);
230+
const top = inset.top;
231231
switch (this.verticalTextAlignment) {
232232
case 'initial': // not supported
233233
case 'top':
@@ -242,7 +242,7 @@ export class Label extends LabelBase {
242242
case 'middle':
243243
case 'center': {
244244
const height = this.computeTextHeight(CGSizeMake(tv.bounds.size.width, 10000));
245-
let topCorrect = (tv.bounds.size.height - height * tv.zoomScale) / 2.0;
245+
let topCorrect = (tv.bounds.size.height + inset.top - inset.bottom - height * tv.zoomScale) / 2.0;
246246
topCorrect = topCorrect < 0.0 ? 0.0 : topCorrect;
247247
// tv.contentOffset = CGPointMake(0, -topCorrect);
248248
this.nativeViewProtected.textContainerInset = {
@@ -256,7 +256,7 @@ export class Label extends LabelBase {
256256

257257
case 'bottom': {
258258
const height = this.computeTextHeight(CGSizeMake(tv.bounds.size.width, 10000));
259-
let bottomCorrect = tv.bounds.size.height - height * tv.zoomScale;
259+
let bottomCorrect = tv.bounds.size.height - inset.bottom - height * tv.zoomScale;
260260
bottomCorrect = bottomCorrect < 0.0 ? 0.0 : bottomCorrect;
261261
// tv.contentOffset = CGPointMake(0, -bottomCorrect);
262262
this.nativeViewProtected.textContainerInset = {

0 commit comments

Comments
 (0)