cursor
cursor copied to clipboard
When using <Text> in react native, auto import does not work, because of the Text interface declartation in lib.dom.d.ts
When using <Text> in react native, there is a type error coming up referring to this interface:
/**
* The textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Text)
*/
interface Text extends CharacterData, Slottable {
/**
* Returns the combined data of all direct Text node siblings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Text/wholeText)
*/
readonly wholeText: string;
/**
* Splits data at the given offset and returns the remainder as Text node.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Text/splitText)
*/
splitText(offset: number): Text;
}
in /Applications/Cursor.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts
Instead of the native Text Component in react native
- If you can, please include a screenshot of your problem
- Please include the name of your operating system macOS 14.2 (23C64)
- If you can, steps to reproduce are super helpful
- Run npx create-expo-app StickerSmash.
- Go into StickerSmash/app/(tabs)/explore.tsx
- Type into the JSX <Text>Explore</Text>
- See the Type Error coming up.