callstack / callstack/react-native-paper

OutlineStyle crashes on Android but not on iOS

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

描述

### Current behaviour
In updating my project to Expo 53 (RN 0.79.5, RNP 5.14.5), I got crashes on Android, but not on iOS. With Expo dev tools it became clear that AndroidTextInput was receiving a ReadableNativeMap that it couldn't cast to a String (in Java). According to RNP:src:components:TextInput:TextInput.tsx:Props:outlineStyle, it's supposed to be a StyleProp, which works fine on iOS. But, on Android, it crashes. Since the type definitions don't allow for the newer (I think) outlineWidth property, I've worked around the problem thus:

const workaround = isAndroid
? { outlineWidth: 1 }
: { outlineStyle: { borderWidth: 1 } }

return

and this seems to work fine.

I don't know where the discrepancy comes it, but maybe someone working on this project knows, FWIW.

### Expected behaviour
No crash, and getting a border of width 1.

### How to reproduce?
Build a project with a Paper TextInput and set outlineStyle to { borderWidth: 1} on Android.

### Preview
https://photos.app.goo.gl/mxwqP1HV19R3tCif9

### What have you tried so far?
I have a workaround; see above

### Your Environment

| software | version
| --------------------- | -------
| ios | x
| android | 14
| react-native | 0.79.5
| react-native-paper | 5.14.5
| node | 22.14.0
| npm or yarn | yarn 4.9.2
| expo sdk | 53.0.19

贡献指南

打开贡献指南

调研方向

从 src/components/TextInput/TextInput.tsx 中的 outlineStyle prop 开始,使用 issue 中的版本,复现将 outlineStyle 设置为 { borderWidth: 1 } 时报告的 Android 崩溃。调查 Android TextInput 路径,然后验证相同的输入不再崩溃,并生成宽度为 1 的边框。

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

评估

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

把新 issue 发到你的邮箱

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