Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Non-flex children not supported for typescript #47

Open
ayc92 opened this issue Jan 15, 2018 · 0 comments
Open

Non-flex children not supported for typescript #47

ayc92 opened this issue Jan 15, 2018 · 0 comments

Comments

@ayc92
Copy link

ayc92 commented Jan 15, 2018

Currently, if I do something like:

<Flexbox>
    <Flexbox flexGrow={1} />
    <Flexbox flex="0 0 45%" />
</Flexbox>

The children Flexbox elements will have display: flex even though I want them to be flex children rather than containers. This isn't a problem for regular javascript, because the propTypes aren't actually enforced, so you could just do <Flexbox display="block" /> for the child element (though even that seems really cumbersome). However, for typescript, the types are actually enforced by the compiler, and display is restricted to flex and inline-flex, so you wouldn't be able to hack around it as I showed above without a compiler error.

An unideal solution would be to not use Flexbox for children, but rather just plain elements, and then to define the flex properties for them elsewhere. However, I'd really rather just be able to use the same API as the container.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant