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

Bug: Setting flex to 0 results in flex 1 #152

Closed
StefanRetief opened this issue Jan 4, 2022 · 1 comment
Closed

Bug: Setting flex to 0 results in flex 1 #152

StefanRetief opened this issue Jan 4, 2022 · 1 comment

Comments

@StefanRetief
Copy link

If you have a reflex container with multiple reflex elements and set one of the element's flex props to 0, it will result in the element sizing as if the flex element was set to undefined.

For example:

<ReflexContainer>
    <ReflexElement flex={0}>
        <div>test</div>
    </ReflexElement>
    <ReflexElement>
        <div>test 2</div>
    </ReflexElement>
</ReflexContainer>

will result in the same sizing as:

<ReflexContainer>
    <ReflexElement>
        <div>test</div>
    </ReflexElement>
    <ReflexElement>
        <div>test 2</div>
    </ReflexElement>
</ReflexContainer>

When the expected result would typically be that the element is minimized. A work around is to set the flex prop to 0.0001, which reduces the size to a negligible size.

@leefsmp
Copy link
Owner

leefsmp commented Jan 4, 2022

yes, it's not really a bug but a limitation as a flex of 0 is not supported by the internal logic of the container (it causes a division by 0). See related talk in #146. The workaround is to not render the ReflexElement at all or to use minSize to avoid flex becoming 0. Hope that helps.

@leefsmp leefsmp closed this as completed Jan 4, 2022
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