Skip to content
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

[Android] Fix column widths #5084

Merged
merged 9 commits into from
Dec 1, 2020
Merged

[Android] Fix column widths #5084

merged 9 commits into from
Dec 1, 2020

Conversation

golddove
Copy link
Member

@golddove golddove commented Nov 16, 2020

Related Issue

Fixes #4988

Description

Auto and fixed width columns were shrinking prematurely. To fix, flex params were set to match the JS renderer params, described below:

fixed: grow - 0, shrink - 0, basis - <px>
auto: grow - 0, shrink - 1, basis - content
stretch: grow - 1, shrink - 1, basis - 0 (JS sets a 50px basis here)
weighted: grow - <weight>, shrink - 1, basis - 0 (JS uses weight in basis here)

Note: Google's FlexboxLayout library doesn't scale flex-shrink values by flex-basis before applying (unlike CSS flex-shrink). This difference means auto columns always shrink to 0 when combined with weighted columns (e.g. the icons along the center vertical line in Agenda.json disappears) if we use the same configuration as JS. To avoid this, weighted columns use flex-grow instead of relying on interaction between flex-shrink and flex-basis.

Sample Card

v1.2\Scenarios\Agenda.json
image

v1.2\Scenarios\FlightDetails.json
image

Also verified with samples from Teams production apps.

How Verified

Manual verification. See screenshots above.

Microsoft Reviewers: Open in CodeFlow

@golddove golddove changed the title Fix column widths [Android] Fix column widths Nov 16, 2020
@RebeccaAnne
Copy link
Contributor

Could you please update the description section to also describe the fix you made to the issue? Thanks!

@ghost ghost added the no-recent-activity label Nov 22, 2020
@ghost ghost assigned dclaux Nov 22, 2020
@ghost
Copy link

ghost commented Nov 22, 2020

Hi @golddove. This non-spec pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@ghost ghost removed the no-recent-activity label Nov 25, 2020
@ghost
Copy link

ghost commented Nov 25, 2020

Hi @golddove; Thanks for taking action on your previously stale pull request. Resetting staleness.

@golddove
Copy link
Member Author

@RebeccaAnne updated description to reflect that the fix was to match the flex properties to match the JS renderer. Added the new values to the description.

@golddove golddove merged commit 077e265 into main Dec 1, 2020
@golddove golddove deleted the golddove/4988 branch December 1, 2020 19:14
@golddove
Copy link
Member Author

golddove commented Dec 1, 2020

Switched weight from flex-basis to flex-grow, as discussed with @dclaux.

Later, should investigate how all other platforms deal with combinations of weight, stretch, auto.

rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
* Fix column widths

* Match JS flex-basis

* flex-basis 0 for stretch

* flex-grow instead of shrink

Co-authored-by: Shalini Joshi-MSFT <shalinij@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android][Column Rendering] Long column content shrinks auto/fixed sized columns
4 participants