fix: use Object.hasOwn in isYogaProp to avoid Object.prototype false positives

"constructor" in {} returns true because it hits Object.prototype.
Using Object.hasOwn ensures only actual yoga prop keys are recognized.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-25 23:58:04 +08:00
parent 3565c5dfb5
commit 9e0bdfcb97
2 changed files with 2 additions and 2 deletions
@@ -185,7 +185,7 @@ test.skip("remeasure text when text nodes are changed — null child crashes yog
expect(lastFrame()).toBe("abcx"); expect(lastFrame()).toBe("abcx");
}); });
test.skip("text with content 'constructor' wraps correctly — bug in text node lookup", async () => { test("text with content 'constructor' wraps correctly", async () => {
const { lastFrame } = await render( const { lastFrame } = await render(
defineComponent(() => () => <Text>constructor</Text>), defineComponent(() => () => <Text>constructor</Text>),
{ columns: 100 }, { columns: 100 },
+1 -1
View File
@@ -224,7 +224,7 @@ function toJustify(v: string): Justify {
} }
export function isYogaProp(key: string): boolean { export function isYogaProp(key: string): boolean {
return key in YOGA_PROP_SETTERS; return Object.hasOwn(YOGA_PROP_SETTERS, key);
} }
const RESETTABLE_PROPS = new Set([ const RESETTABLE_PROPS = new Set([