Add JavaScript bindings for YGHasNewLayout (#1631)
Summary: Adds JavaScript bindings for YGHasNewLayout which introduces two new node methods: `hasNewLayout()` and `markLayoutSeen()`. Closes https://github.com/facebook/yoga/issues/681 Pull Request resolved: https://github.com/facebook/yoga/pull/1631 Reviewed By: joevilches Differential Revision: D55213296 Pulled By: NickGerleman fbshipit-source-id: 161288c3f54c2b82a6b2b842387916fe8713c2c9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9dcd8ba9dc
commit
5cbc7b4f1c
@@ -59,11 +59,23 @@ void applyLayout(YogaNode node) {
|
||||
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
:::danger
|
||||
```javascript
|
||||
void applyLayout(node) {
|
||||
if (!node.hasNewLayout()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Yoga's JavaScript bindings are missing support for accessing the `HasNewLayout` flag. https://github.com/facebook/yoga/issues/681
|
||||
// Reset the flag
|
||||
node.markLayoutSeen();
|
||||
|
||||
:::
|
||||
// Do the real work
|
||||
...
|
||||
|
||||
for (let i = 0; i < node.getChildCount(); i++) {
|
||||
applyLayout(node.getChildAt(i));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
Reference in New Issue
Block a user