Skip to content

Commit 9621856

Browse files
committed
fix: ios fix after last commit on vertical text alignment
1 parent bf3ebe8 commit 9621856

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/label.ios.ts

+5-5
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 = inset.top;
230+
const top = layout.toDeviceIndependentPixels(this.effectivePaddingTop + this.effectiveBorderTopWidth);
231231
switch (this.verticalTextAlignment) {
232232
case 'initial': // not supported
233233
case 'top':
@@ -242,9 +242,9 @@ 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 + inset.top - inset.bottom - height * tv.zoomScale) / 2.0;
245+
const bottom = layout.toDeviceIndependentPixels(this.effectivePaddingBottom + this.effectiveBorderBottomWidth);
246+
let topCorrect = (tv.bounds.size.height - bottom - height * tv.zoomScale) / 2.0;
246247
topCorrect = topCorrect < 0.0 ? 0.0 : topCorrect;
247-
// tv.contentOffset = CGPointMake(0, -topCorrect);
248248
this.nativeViewProtected.textContainerInset = {
249249
top: top + topCorrect,
250250
left: inset.left,
@@ -256,9 +256,9 @@ 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 - inset.bottom - height * tv.zoomScale;
259+
const bottom = layout.toDeviceIndependentPixels(this.effectivePaddingBottom + this.effectiveBorderBottomWidth);
260+
let bottomCorrect = tv.bounds.size.height - bottom - height * tv.zoomScale;
260261
bottomCorrect = bottomCorrect < 0.0 ? 0.0 : bottomCorrect;
261-
// tv.contentOffset = CGPointMake(0, -bottomCorrect);
262262
this.nativeViewProtected.textContainerInset = {
263263
top: top + bottomCorrect,
264264
left: inset.left,

0 commit comments

Comments
 (0)