Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit dea4d81

Browse files
committed
chore: Note to self
1 parent 05a72aa commit dea4d81

File tree

1 file changed

+14
-0
lines changed
  • src/dom/nativescript-vue-next/runtime

1 file changed

+14
-0
lines changed

src/dom/nativescript-vue-next/runtime/nodes.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,20 @@ export class NSVElement<T extends NativeView = NativeView> extends NSVNode imple
460460
private static readonly recycledOldProps: Record<string, any> = Object.freeze({});
461461

462462
setAttribute(name: string, value: unknown) {
463+
/*
464+
* A note to myself after following this rabbit hole several times before:
465+
* Users may intuitively try to set the "text" property on an element such as <text>, simply because
466+
* it's a likely property name to expect, and because it appears to be corroborated by Intellisense,
467+
* due to our default of typing any unrecognised JSX key as a string value.
468+
*
469+
* In fact, RNText doesn't implement a text property in its setProps() method, so it (correctly) no-ops.
470+
* To set text, we expect users to write it as:
471+
*
472+
* <text>hello</text>
473+
*
474+
* ... This creates an NSVText node with the text "hello", which Svelte reads using the .data accessor.
475+
*/
476+
463477
["style",
464478
"styleSheet", // TODO: implement
465479
"class",

0 commit comments

Comments
 (0)