Skip to content

Commit b0497af

Browse files
kubaflosheiksyedm
authored andcommitted
Revert "[iOS] Button RTL text and image overlap - fix (#29041)"
This reverts commit d15854a.
1 parent 899042c commit b0497af

File tree

7 files changed

+21
-92
lines changed

7 files changed

+21
-92
lines changed

src/Controls/src/Core/Button/Button.iOS.cs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,10 @@ void LayoutButton(UIButton platformButton, Button button, Rect size)
204204
// Which makes the later math easier to follow
205205
if (layout.Position == ButtonContentLayout.ImagePosition.Left || layout.Position == ButtonContentLayout.ImagePosition.Right)
206206
{
207-
// In RTL mode, physical Left/Right offsets must be reversed.
208-
// Use EffectiveFlowDirection to handle both explicit and inherited RTL.
209-
nfloat dir = ((IVisualElementController)button).EffectiveFlowDirection.IsRightToLeft() ? -1 : 1;
210-
211-
imageInsets.Left += dir * (titleWidth / 2);
212-
imageInsets.Right -= dir * (titleWidth / 2);
213-
titleInsets.Left -= dir * (imageWidth / 2);
214-
titleInsets.Right += dir * (imageWidth / 2);
215-
216-
imageInsets.Left -= dir * ((titleWidth / 2) + sharedSpacing);
217-
imageInsets.Right += dir * ((titleWidth / 2) + sharedSpacing);
218-
titleInsets.Left += dir * ((imageWidth / 2) + sharedSpacing);
219-
titleInsets.Right -= dir * ((imageWidth / 2) + sharedSpacing);
207+
imageInsets.Left += titleWidth / 2;
208+
imageInsets.Right -= titleWidth / 2;
209+
titleInsets.Left -= imageWidth / 2;
210+
titleInsets.Right += imageWidth / 2;
220211
}
221212

222213
if (layout.Position == ButtonContentLayout.ImagePosition.Top)
@@ -245,6 +236,23 @@ void LayoutButton(UIButton platformButton, Button button, Rect size)
245236
titleInsets.Right += (nfloat)padding.Right;
246237

247238
}
239+
else if (layout.Position == ButtonContentLayout.ImagePosition.Left)
240+
{
241+
imageInsets.Left -= (titleWidth / 2) + sharedSpacing;
242+
imageInsets.Right += (titleWidth / 2) + sharedSpacing;
243+
244+
titleInsets.Left += (imageWidth / 2) + sharedSpacing;
245+
titleInsets.Right -= (imageWidth / 2) + sharedSpacing;
246+
247+
}
248+
else if (layout.Position == ButtonContentLayout.ImagePosition.Right)
249+
{
250+
imageInsets.Left += (titleWidth / 2) + sharedSpacing;
251+
imageInsets.Right -= (titleWidth / 2) + sharedSpacing;
252+
253+
titleInsets.Left -= (imageWidth / 2) + sharedSpacing;
254+
titleInsets.Right += (imageWidth / 2) + sharedSpacing;
255+
}
248256
}
249257

250258
#pragma warning disable CA1416, CA1422

src/Controls/tests/TestCases.HostApp/Issues/Issue29036.cs

Lines changed: 0 additions & 59 deletions
This file was deleted.
Binary file not shown.

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29036.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)