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

Overhaul layout manager #1

Merged
merged 12 commits into from
Sep 2, 2022
Merged

Overhaul layout manager #1

merged 12 commits into from
Sep 2, 2022

Conversation

j-piasecki
Copy link
Owner

Description

This PR is focused on rebuilding the layout manager. Instead of measuring children at every step it now passes the tree two times at most. The first pass calculates whatever it can and propagates calculated sizes upwards from children to parents. The second pass relies on the propagated values to calculate the rest of the children. Algorithm is more thoroughly explained in the code comments.

In addition to the new algorithm it also adds more complex layout calculations for columns, rows and stacks, which allows creating more complex UIs. It also handles RTL layouts, and adds isRTL check to ViewManager.

@j-piasecki
Copy link
Owner Author

Fun fact: on the current index.ts in the web-tester (12 views) the new manager invokes calculateSize 14 times, while the old does it 24 times 🙂.

@j-piasecki j-piasecki merged commit 838966e into main Sep 2, 2022
@j-piasecki j-piasecki deleted the overhaul-layout-manager branch September 2, 2022 08:35
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