callstack / callstack/react-native-paper

Multiline text in SegmentedButtonItem

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

描述

Hi! 👋

Firstly, thanks for your work on this project! 🙂
Today I used [patch-package](https://github.com/ds300/patch-package) to patch `react-native-paper@5.12.3` for the project I'm working on.

I needed multiline text in `SegmentedButtonItem`. So i removed `numberOfLines` and vertically centered `TouchableRipple`'s content. Would be nice to have option to change those props in next versions.

Here is the diff that solved my problem:

```diff
diff --git a/node_modules/react-native-paper/src/components/SegmentedButtons/SegmentedButtonItem.tsx b/node_modules/react-native-paper/src/components/SegmentedButtons/SegmentedButtonItem.tsx
index d88f2a4..600859e 100644
--- a/node_modules/react-native-paper/src/components/SegmentedButtons/SegmentedButtonItem.tsx
+++ b/node_modules/react-native-paper/src/components/SegmentedButtons/SegmentedButtonItem.tsx
@@ -214,7 +214,10 @@ const SegmentedButtonItem = ({
disabled={disabled}
rippleColor={rippleColor}
testID={testID}
- style={rippleStyle}
+ style={[rippleStyle, {
+ flex: 1,
+ justifyContent: 'center'
+ }]}
background={background}
theme={theme}
>
@@ -236,7 +239,6 @@ const SegmentedButtonItem = ({
variant="labelLarge"
style={[styles.label, labelTextStyle, labelStyle]}
selectable={false}
- numberOfLines={1}
maxFontSizeMultiplier={labelMaxFontSizeMultiplier}
testID={`${testID}-label`}
>
```

This issue body was [partially generated by patch-package](https://github.com/ds300/patch-package/issues/296).

贡献指南

打开贡献指南

调研方向

从 src/components/SegmentedButtons/SegmentedButtonItem.tsx 开始,将报告中的补丁与当前组件的 props 和布局进行比较。当 SegmentedButtonItem 支持多行标签,并为相关的文本和 TouchableRipple props 提供选项时,工作即完成。

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

评估

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

把新 issue 发到你的邮箱

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