callstack / callstack/react-native-paper
TypeScript errors: Text cannot be used as JSX component / styled(Text) type mismatch
- Dominant language
- TypeScript
- Stars
- 14.5k
- Forks
- 2.2k
- Avg merge
- 5d 23h
- Merged PRs (30d)
- 12
Description
### Current behaviour
We started encountering TypeScript errors after upgrading react-native-paper to the latest version (v5.15.0).
Running bun run tsc:check fails with 54 TypeScript errors across 22 files.
The errors are consistently related to usage of Text components—both when used directly in JSX and when wrapped with styled(Text).
TypeScript compilation fails.
1. Text cannot be used as a JSX component
```
error TS2786: 'Text' cannot be used as a JSX component.
Its return type 'ReactNode' is not a valid JSX element.
```
2. styled(Text) type incompatibility
`error TS2345: Argument of type 'TextComponent' is not assignable to parameter of type 'NativeTarget' | 'WebTarget'.`
### Expected behaviour
### How to reproduce?
`bun run tsc:check`
### Preview
### What have you tried so far?
Probably after this change:
https://github.com/callstack/react-native-paper/pull/4842/changes#diff-565345c81708889e368103ec926f7b042596e20ec51abce9df33fc3c72ad8462
### Your Environment
| software | version
| --------------------- | -------
| ios | x
| android | x
| react-native | 0.83.1
| react-native-paper | 5.15.0
| node | 24.0.0
| npm or yarn | 11.3.0
| expo sdk | x.x.x
Contributor guide
Research direction
Run `bun run tsc:check` to reproduce the 54 errors across 22 files, then inspect the change referenced from react-native-paper pull request 4842. Trace the affected Text and styled(Text) usages and verify that TypeScript compilation completes without these errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100