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

Update styles.ts: add support to top,left,bottom and right #695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YPetremann
Copy link

@YPetremann YPetremann commented Jan 23, 2025

This add support for absolute and relative positionning with top,left,bottom and right

<Box position="absolute" bottom={0} right={0} width={5} height={5} borderStyle="single">
  <Text>Hello</Text>
</Box>

This directly use yoga node.setPosition(edge, position) :

  • If the node is static then insets have no effect.
  • If the node is relative then insets will move the node the designated amount from where the node would normally be in the container. Each inset property is relative to the node's corresponding physical edge. So YGNodeStyleSetPosition(node, YGEdgeRight, 10.0f) will offset the node so that the right edge is 10 units away from where the right edge would be originally.
  • If the node is absolute then insets will move the node the designated amount away from the node's containing block. So YGNodeStyleSetPosition(node, YGEdgeRight, 10.0f) will offset the node so that the right edge is 10 units away from the containing block's right edge.

This add support for absolute positionning with top,left,bottom and right
@YPetremann YPetremann force-pushed the absolute-positioning branch from dfa5528 to a176a7f Compare January 23, 2025 11:06
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

Successfully merging this pull request may close these issues.

1 participant