-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed iOS button flickering animation with is Top or Bottom ContentLayout when text it updated at run time #25662
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Very interesting find :) |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Compared to the previous button content alignment behavior, my fix causes the image to shift by 1 pixel. As a result, some test cases failed on the iOS platform. Therefore, I replaced the images with new ones generated by CI. |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
@tj-devel709 this looks like a reasonable change to me... any concerns with the approach here? |
fccde3d
to
dcd6141
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 21 out of 22 changed files in this pull request and generated no suggestions.
Files not reviewed (1)
- src/Controls/tests/TestCases.HostApp/Issues/Issue25487.xaml: Language not supported
Comments skipped due to low confidence (2)
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25487.cs:18
- The test case should explicitly verify that the flickering issue is resolved by checking the button's position before and after the text change.
App.Tap("ToggleTextButton");
src/Controls/tests/TestCases.HostApp/Issues/Issue25487.xaml.cs:11
- [nitpick] The variable name '_isToggled' is ambiguous. It should be renamed to '_isButtonTextToggled' to better describe its purpose.
bool _isToggled;
Azure Pipelines successfully started running 3 pipeline(s). |
This PR issue has already been resolved with this PR #26018, so we can close it. |
Issue Details
Modifying a button's text from a long string to a short one (or vice versa) with the image and content layout set to 'Top' causes the image to shift momentarily from the center to the start position before returning to the center.
Root Cause
When the button content layout is set to 'top' or 'bottom,' the ImageInsets adjusts based on the text width. Whenever the text width changes, this causes the ImageInsets to be modified in real-time, resulting in an image flicker when updating the text.
Description of Change
If the content layout is set to 'Top' or 'Bottom,' we can calculate the image insets for the button based on its width and the image width.
Validated the behaviour in the following platforms
Issues Fixed
Fixes #25487
Output
Before.IOS.mov
After.IOS.mov
Before.MAC.mov
After.Mac.mov
Android
Android.mov