Skip to content

Can't get basic layout to work #1067

Answered by aarthificial
A-Walrus asked this question in Q&A
Discussion options

You must be logged in to vote

Apologies, I forgot that Txt nodes force-enable layout because they use it to lay out the text inside them.
Setting layout={false} would work if you had a different node inside, say a Circle.

Well then, justifyContent would be the way to go in this case.
Alternatively, you could wrap the Txt in it's own Layout and disable it this way:

<Rect width={100} height={100} fill="gray" radius={15}>
  <Layout layout={false}>
    <Txt>0</Txt>
  </Layout>
</Rect>

But that's probably more verbose than justifyContent + alignItems

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@A-Walrus
Comment options

@aarthificial
Comment options

@A-Walrus
Comment options

@aarthificial
Comment options

Answer selected by A-Walrus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants