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:
@@ -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 },
|
||||||
|
|||||||
@@ -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([
|
||||||
|
|||||||
Reference in New Issue
Block a user