google / flexbox-layout

Flexbox for Android
Apache License 2.0
18.22k stars 1.79k forks source link

Preventing negative child width when shrinking on no wrap #639

Open siczmj opened 3 months ago

siczmj commented 3 months ago

This minor change fixes an issue where a child view may have a negative width during shrinking in no wrap flex wrap mode. If you look at the playground app, you will be able to reproduce it by setting the wrap mode to no wrap, and merely add more than 10 items. The horizontal FlexLine measurement going to be modified incorrectly due to a negative child view width. This may happen if a child view is already narrow and you force to shrink more.

Issue before fix Correct behavior after fix
no-wrap-shrinking-issue-negative-child-measure-width no-wrap-shrinking-fix-negative-child-measure-width