callstack / callstack/react-native-paper
TypeScript errors: Text cannot be used as JSX component / styled(Text) type mismatch
- 主要语言
- TypeScript
- 星标
- 14.5k
- 派生
- 2.2k
- 平均合并
- 5 天 23 小时
- 30 天内合并 PR
- 12
描述
### 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
贡献指南
调研方向
运行 `bun run tsc:check` 以复现分布在 22 个文件中的 54 个错误,然后检查 react-native-paper 的 pull request 4842 中引用的更改。跟踪受影响的 Text 和 styled(Text) 用法,并确认 TypeScript 编译能够在没有这些错误的情况下完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react-native, typescript
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100