callstack / callstack/react-native-paper

Why `AnimatedText` is not exported?

未关闭
#3,818 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question Typography
主要语言
TypeScript
星标
14.5k
派生
2.2k
平均合并
5 天 23 小时
30 天内合并 PR
12

描述

I've created a text component that "bounces" on press applying a simple scaling transformation:
```

```

I've noticed that `AnimatedText` is not exported and I had to import it like:
```
import AnimatedText from "react-native-paper/src/components/Typography/AnimatedText";
```

And even so, there seems to be a couple of TS issues:
```
node_modules/react-native-paper/src/components/Typography/AnimatedText.tsx:67:44 - error TS2339: Property 'regular' does not exist on type 'Fonts | ({ displayLarge: MD3Type; displayMedium: MD3Type; displaySmall: MD3Type; headlineLarge: MD3Type; headlineMedium: MD3Type; ... 9 more ...; bodySmall: MD3Type; } & { ...; })'.
Property 'regular' does not exist on type '{ displayLarge: MD3Type; displayMedium: MD3Type; displaySmall: MD3Type; headlineLarge: MD3Type; headlineMedium: MD3Type; headlineSmall: MD3Type; ... 8 more ...; bodySmall: MD3Type; } & { ...; }'.

67 const font = !theme.isV3 ? theme.fonts.regular : theme.fonts.bodyMedium;
~~~~~~~

node_modules/react-native-paper/src/components/Typography/AnimatedText.tsx:70:65 - error TS2339: Property 'text' does not exist on type 'MD2Colors | MD3Colors'.
Property 'text' does not exist on type 'MD3Colors'.

70 color: theme.isV3 ? theme.colors.onSurface : theme.colors.text,
```

I'm wondering, is `AnimatedText` supposed to be exported and the TS issues fixed OR is there another recommended way to achieve what I'm trying to do?

贡献指南

打开贡献指南

调研方向

从 src/components/Typography/AnimatedText.tsx 和 package 的公共导出入口开始。重现报告的 TypeScript 错误,然后确定 AnimatedText 是否应成为公共 API 的一部分,还是预期采用其他受支持的方式;当所选 API 已通过其导出得到文档说明,且报告的类型错误已解决或得到明确处理时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native, typescript
领域
mobile
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。