react / react/react-native

Click and hold to select text using a text component

未关闭
#13,938 55 条评论 91 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Resolution: Locked
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

I want click-and-hold-to-select-text using a Text component and then i searched it and i found selectable property.It good works but it copy the entire text field.I want to selecting a subset of the text field for copying.Actually this question is asked on stackoverflow .Here is question on stackoverflow:http://stackoverflow.com/a/37119619/4596143

Reproduction Steps and Sample Code

I try this code block:

<Text
                        selectable={true}
                        style={styles.messageBody}>
                        {"text description"}
</Text>

This full of text ("text description") can copy not partially .I want to it like screenshot

Actual behaviour:
image

Expected behavior:

image

Solution

They are said that RN 0.39 adds support to copy the entire text field, but does not yet include support for selecting a subset of the text field for copying on stackoverflow .I wonder Text component include support for selecting a subset of the text field for copying on new versions for react native.If the property does not exist on new versions ,will the property for text integrate ?

Additional Information
  • React Native version:^0.43
  • Platform: IOS
  • Development Operating System: macOS

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 React Native Text 组件在 iOS 上的可选择行为入手,并使用 selectable={true} 的示例复现该问题。将当前复制整个字段的行为与预期的部分文本选择进行比较;当用户可以点击并长按以选择和复制 Text 内容的子集时,即表示完成。

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

评估

技术栈
ios, react-native
领域
mobile
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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