Skip to content

fix(button-android): use setMinWidth to set TextView widgets min-width#7804

Merged
vtrifonov merged 8 commits into
masterfrom
bundev/fix-button-min-width
Mar 26, 2020
Merged

fix(button-android): use setMinWidth to set TextView widgets min-width#7804
vtrifonov merged 8 commits into
masterfrom
bundev/fix-button-min-width

Conversation

@bundyo

@bundyo bundyo commented Sep 10, 2019

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

Aligned Buttons with short text have a min-width that can't be removed.

What is the new behavior?

Removes the min-width. According to Android docs:

The value given with TextView.setMinWidth(int) is different than View.setMinimumWidth(int). Between setMinWidth and the value set in View.setMinimumWidth(int), the greater one is used to decide the final width.

Thus for TextViews as the Button, both should be set.

https://developer.android.com/reference/android/widget/TextView.html#setMinWidth(int)

Fixes/Implements/Closes #7803.

@bundyo bundyo added the bug label Sep 10, 2019
@bundyo bundyo self-assigned this Sep 10, 2019
@cla-bot cla-bot Bot added the cla: yes label Sep 10, 2019
@manoldonev manoldonev changed the title fix(Button): Use setMinWidth for setting min-width of Android TextView widgets fix(button-android): use setMinWidth to set TextView widgets min-width Sep 12, 2019
@manoldonev manoldonev changed the base branch from master to release October 18, 2019 15:16
@manoldonev manoldonev changed the base branch from release to master October 22, 2019 10:54
@manoldonev manoldonev changed the base branch from master to release October 22, 2019 10:54
@manoldonev manoldonev removed the patch label Oct 22, 2019
@vakrilov vakrilov force-pushed the bundev/fix-button-min-width branch 2 times, most recently from fde5cdd to 9b01c59 Compare December 12, 2019 12:52
@vakrilov

Copy link
Copy Markdown
Contributor

There seems to be a behavior change with this PR. The default min-width of the android buttons is no longer present.
Here is a screenshot of one fo the test app to get the idea:

Before:
dialogs_11_alert_expected

After:
dialogs_11_alert_actual

This has a potential of breaking client apps. @bundyo do you think there is a way to make this back-compatible?

@vakrilov vakrilov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be a behavior change detected by the e2e tests.
See #7804 (comment)

@bundyo

bundyo commented Jan 14, 2020

Copy link
Copy Markdown
Contributor Author

We might introduce a default min-width for the property?

@vakrilov vakrilov self-assigned this Jan 22, 2020
@vakrilov vakrilov force-pushed the bundev/fix-button-min-width branch from f45b01d to e202fb6 Compare January 22, 2020 14:37
@vakrilov

Copy link
Copy Markdown
Contributor

test

@vakrilov vakrilov force-pushed the bundev/fix-button-min-width branch 2 times, most recently from 73237d2 to fd2888b Compare January 27, 2020 19:55
@vakrilov

Copy link
Copy Markdown
Contributor

test

@vakrilov vakrilov force-pushed the bundev/fix-button-min-width branch from fd2888b to 88e7ab6 Compare February 3, 2020 08:04
* release: cut 6.5.0 release

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
@dtopuzov dtopuzov changed the base branch from release to master March 26, 2020 08:05
@vtrifonov vtrifonov merged commit 66cc8a4 into master Mar 26, 2020
@vtrifonov vtrifonov deleted the bundev/fix-button-min-width branch March 26, 2020 11:07
NathanWalker pushed a commit that referenced this pull request Aug 7, 2020
#7804)

* fix: setMinimumWidth does not really set the minWidth for TextView widgets

* chore: fix versions

* refactor(android): default minWidth/Height values for button

* reafctor: reset minWidth when view is in flexbox for backcompat

* refactor: ensure back-compatible layout for btns

* chore: cut 6.5.0 release (#8443)

* release: cut 6.5.0 release

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>

Co-authored-by: vakrilov <alexander.vakrilov@telerik.com>
Co-authored-by: Dimitar Topuzov <dtopuzov@gmail.com>
Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android Buttons have min-width that can't be removed

5 participants