-
Notifications
You must be signed in to change notification settings - Fork 24k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove copy tooltip on Text that is not selectable - iOS #13618
Labels
Resolution: Locked
This issue was locked by the bot.
Comments
This was referenced Apr 21, 2017
Thank you, Gabriel! |
@gabrielbull Awesome! Please address the comments. :) |
facebook-github-bot
pushed a commit
that referenced
this issue
Apr 27, 2017
Summary: This PR solves issue #13618. Selectable text still behaves the same way: ```jsx <Text selectable={true}>yo yo yo</Text> ``` ![capture d ecran 2017-04-21 a 17 10 51](https://cloud.githubusercontent.com/assets/671923/25296285/85eba646-26b5-11e7-8773-e5e55ee0d7bb.png) Text that is not selectable and has a custom tooltip now do not include the copy item: ```jsx import * as React from 'react'; import { Text } from 'react-native'; import ToolTip from 'react-native-tooltip'; const MyComponent = () => ( <Text> <Text>This is my text.</Text> <ToolTip actions={[ {text: 'My', onPress: (): any => null }, {text: 'Context', onPress: (): any => null }, {text: 'Menu', onPress: (): any => null }, ]} underlayColor='transparent' longPress={true} arrowDirection='down' > <Text>You can long press me for a tooltip.</Text> </ToolTip> <Text>This is the rest of my text</Text> </Text> ); export default MyComponent; ``` ![capture d ecran 2017-04-21 a 17 10 56](https://cloud.githubusercontent.com/assets/671923/25296297/970949ba-26b5-11e7-8378-3bf0289d1a5a.png) Closes #13619 Reviewed By: shergin Differential Revision: D4936900 Pulled By: ericvicenti fbshipit-source-id: 82028b0958c37d63b8a80882196295be4aebecb4
Fixed with the PR. |
thotegowda
pushed a commit
to thotegowda/react-native
that referenced
this issue
May 7, 2017
Summary: This PR solves issue facebook#13618. Selectable text still behaves the same way: ```jsx <Text selectable={true}>yo yo yo</Text> ``` ![capture d ecran 2017-04-21 a 17 10 51](https://cloud.githubusercontent.com/assets/671923/25296285/85eba646-26b5-11e7-8773-e5e55ee0d7bb.png) Text that is not selectable and has a custom tooltip now do not include the copy item: ```jsx import * as React from 'react'; import { Text } from 'react-native'; import ToolTip from 'react-native-tooltip'; const MyComponent = () => ( <Text> <Text>This is my text.</Text> <ToolTip actions={[ {text: 'My', onPress: (): any => null }, {text: 'Context', onPress: (): any => null }, {text: 'Menu', onPress: (): any => null }, ]} underlayColor='transparent' longPress={true} arrowDirection='down' > <Text>You can long press me for a tooltip.</Text> </ToolTip> <Text>This is the rest of my text</Text> </Text> ); export default MyComponent; ``` ![capture d ecran 2017-04-21 a 17 10 56](https://cloud.githubusercontent.com/assets/671923/25296297/970949ba-26b5-11e7-8378-3bf0289d1a5a.png) Closes facebook#13619 Reviewed By: shergin Differential Revision: D4936900 Pulled By: ericvicenti fbshipit-source-id: 82028b0958c37d63b8a80882196295be4aebecb4
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
When creating a custom tooltip (could be using react-native-tooltip), if the custom tooltip is within a Text element, the tooltip will inevitably have the Copy item without any way of removing it.
This is because of the lines 239, 240, 241 of react-native/Libraries/Text/RCTText.m, introduced by @shergin on this commit 5d03ff8 .
Reproduction Steps and Sample Code
Create a custom tooltip inside a
Text
component.The
Text
component can have theselectable
property set totrue
orfalse
, it does not affect this issue.Solution
If the
selectable
property on theText
component is set to true, the behaviour should remain the same. However, if it set tofalse
, the Copy item should not show in the tooltip.To fix this, the following lines should be changed to have a condition to only accept the copy item if the text is selectable:
Additional Information
The text was updated successfully, but these errors were encountered: