Skip to content

Commit 21680f2

Browse files
J8118meta-codesync[bot]
authored andcommitted
Fix incorrect code examples in documentation (#1926)
Summary: Two small fixes to code examples in the documentation: - **`external-layout-systems.mdx`:** The C/C++ tab declares `Widget widget{};` on line 24 but then references `&w` on line 26. Fixed to `&widget` to match the declared variable. The Java tab already uses the correct name (`widget`). - **`incremental-layout.mdx`:** The JavaScript tab uses `void applyLayout(node) {` which is not valid JavaScript syntax. Fixed to `function applyLayout(node) {`. This appears to have been introduced in #1631 when the JS example was added by adapting the Java tab — other language-specific syntax was updated (`int` → `let`, type annotations removed) but the `void` return type was not changed to `function`. The code block is tagged as ` ```javascript ` and all other lines use valid JS syntax, confirming this was a copy-paste oversight rather than intentional pseudocode. Pull Request resolved: #1926 Reviewed By: NickGerleman Differential Revision: D100143877 Pulled By: fabriziocucci fbshipit-source-id: 6d7a88d044ca369fa69046beb58c2e5f1256a27c
1 parent 9cc48ef commit 21680f2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

website/docs/advanced/external-layout-systems.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Measure functions in the C/C++ APIs are represented as C function pointers and d
2323
```cpp
2424
Widget widget{};
2525

26-
YGNodeSetContext(node, &w);
26+
YGNodeSetContext(node, &widget);
2727
YGNodeSetMeasureFunc(node, &measureWidget);
2828
```
2929

website/docs/advanced/incremental-layout.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void applyLayout(YogaNode node) {
6060
<TabItem value="js" label="JavaScript">
6161

6262
```javascript
63-
void applyLayout(node) {
63+
function applyLayout(node) {
6464
if (!node.hasNewLayout()) {
6565
return;
6666
}

0 commit comments

Comments
 (0)