Does RNSkia need a layout engine? #3097
jack-beanstalk-2022
started this conversation in
General
Replies: 1 comment 1 reply
-
I agree. A layout engine would be great. If you were to implement it, we could add the extensions you need from the reconciler to help you calculate the layout. Very similar to how Skia (or paragraph API which is also a layout api in a way) works. First we would need an imperative api that works for Skia and then we could add the declarative approach (again very similar to how the paragraph API works but generalized to all canvas commands). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my recent work with RNSkia I realized we need a layout engine to support the kind of flexibility native UI has. Here is a motivating example:
Suppose I have a RNSkia "Paragraph" with a line "Path" directly below it.

I'd like the "Paragraph" to take the whole width of the screen but on different phones the "Paragraph" would take different height (on a wide phone that two-liner becomes one-liner). As a result the line below it needs to be on different position.
This is an easy example that can be done today with RNSkia + a few lines of code. But consider a complex screen with a lot of elements of dynamic sizes and deep hierarchy, it can get out of hand pretty quickly.
On the native/raw RN side this is supported well, e.g. using the iOS auto layout / flexbox. Elements have intrinsic sizes and there is a layout engine to place elements w.r.t. that.
My question:
Did I miss anything?
If I have to do this myself, is there any recommendation on how to implement my own layout engine?
Beta Was this translation helpful? Give feedback.
All reactions