triniwiz / triniwiz/nativescript-plugins
YogaLayout does not support "auto" width or height
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 87
- Forks
- 57
- Avg merge
- 1h 36m
- Merged PRs (30d)
- 4
Description
Identified in https://github.com/triniwiz/nativescript-plugins/pull/59#issue-650754348
I can only fit a screen's worth of test cases because the YogaLayout component doesn't seem to implement "auto" height. Thus it won't size to its contents and instead must take a fraction of the available container space. The worst thing about this is that once the screen runs out of space to fit all examples, NativeScript is unable to solve the layout and stalls indefinitely.
Only once "auto" height is supported can we have a scrolling list of examples (which will let us see all test cases).
Example of the issue
I illustrate this issue with a full-screen scrollview that contains the examples:
<scrollView orientation="vertical">
<yoga flexDirection="column">
{examples.map((example, i) => {
return (
<yoga>{/* ... */}</yoga>
);
})}
</yoga>
</scrollView>
I control the number of examples by adjusting the slice() value on this line:
6 test cases on page
Here, the 6 test cases cut up the screen into 6 equal divisions, clearly not referring to the child size.

12 test cases on page
Next, I ask for 12 test cases and things get strange. It can only fit 9 on screen and yet doesn't enable scrolling on the containing ScrollView. Of note, the TextViews are not reserving any space for themselves, and so those gain individual scrollbars.

16 test cases on page
Doesn't appear any different from 12 test cases. Again, no scrolling on the ScrollView.

More test cases on page
NativeScript becomes unresponsive..!
Related issues
Lack of "auto" support may explain: https://github.com/triniwiz/nativescript-plugins/issues/57
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the example entry point in apps/demo-react/src/components/AppContainer.tsx, especially the slice() value used to vary the number of examples, and reproduce the layout with the full-screen ScrollView shown here. Compare the six, twelve, and sixteen-example cases. Done means YogaLayout supports auto sizing so the ScrollView can contain and scroll through all examples without stalled layout or missing child space.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100