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

indexInFlexLine is not consistent in onNewFlexItemAdded() method #606

Open
blah1234 opened this issue Jul 30, 2022 · 1 comment
Open

indexInFlexLine is not consistent in onNewFlexItemAdded() method #606

blah1234 opened this issue Jul 30, 2022 · 1 comment

Comments

@blah1234
Copy link

blah1234 commented Jul 30, 2022

  • [X ] I have searched existing issues and confirmed this is not a duplicate

Issues and steps to reproduce

In FlexboxHelper.calculateFlexLines(), there is the following code block:

if (isWrapRequired(child, mainMode, mainSize, flexLine.mMainSize,
                    getViewMeasuredSizeMain(child, isMainHorizontal)
                            + getFlexItemMarginStartMain(flexItem, isMainHorizontal) +
                            getFlexItemMarginEndMain(flexItem, isMainHorizontal),
                    flexItem, i, indexInFlexLine, flexLines.size())) {
                <snip!>

                flexLine = new FlexLine();
                flexLine.mItemCount = 1;
                flexLine.mMainSize = mainPaddingStart + mainPaddingEnd;
                flexLine.mFirstIndex = i;
 -->               indexInFlexLine = 0;    <---
                largestSizeInCross = Integer.MIN_VALUE;
            } else {
                flexLine.mItemCount++;
-->                indexInFlexLine++;     <---
            }

So for the 1st FlexLine in FlexboxLayout, indexInFlexLine starts at 1, but for all subsequent FlexLines in the FlexboxLayout, indexInFlexLine starts at 0.

Expected behavior

indexInFlexLine should be consistently 0-indexed

Version of the flexbox library

3.0.0

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

No branches or pull requests

2 participants
@blah1234 and others