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

Width: auto on flex containers not taking the full space available #44

Open
afk-mario opened this issue Mar 19, 2021 · 4 comments
Open
Labels
bug Something isn't working

Comments

@afk-mario
Copy link

I'm trying to make a column based layout where each row takes all the space available in the flex container if I set the width to be 100% the box overflows the flex parent container, if I use width="auto" the width of the child box is 0, in the Yoga layout demo works as expected.

Yoga Demo

three-flex demo

https://codesandbox.io/s/weathered-wildflower-9urbo?file=/src/styles.css

@afk-mario afk-mario changed the title Width: auto on column direction flex containers not taking the full space available Width: auto on flex containers not taking the full space available Mar 19, 2021
@afk-mario
Copy link
Author

Also the bottom padding seems to be cut of not sure if that's my re flow logic

@giulioz
Copy link
Member

giulioz commented Mar 20, 2021

That's because you have set align="flex-start", whereas in the yoga example is set as stretch. Setting that and using auto width makes the box fill all the width.

What do you mean for the bottom padding to be cut?

@afk-mario
Copy link
Author

Ah makes total sense thanks!

The bottom padding on the flex container

image

There should be a space between the last element and the border of the view port.

@MaxTwentythree
Copy link

MaxTwentythree commented Jun 11, 2021

I think I have a similar issue

      <Flex
        justifyContent="center"
        alignItems="stretch"
        size={[size[0], size[1], 0]}
        padding={20}
      >
        <Box width="100%" height="100%">
          {(width, height): ReactElement<Mesh> => (
            <mesh>
              <planeBufferGeometry attach="geometry" args={[width, height]}/>
              <meshBasicMaterial color={green} />
            </mesh>
          )}
        </Box>
      </Flex>

(the Flex gets the same size as the white block)

image

Shouldn't the green rectangle be centered (paddings on each side) or am I doing sth wrong?

Edit:
After replacing padding={20} with pr={20} pb={20} it works, but this not what I would expect ... so still the question: ist this a bug or am I doing sth wrong?
image

@talentlessguy talentlessguy added the bug Something isn't working label Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants