mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Fixed issue where the copy item would be added to the tooltips on the…
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 https://github.com/facebook/react-native/pull/13619 Reviewed By: shergin Differential Revision: D4936900 Pulled By: ericvicenti fbshipit-source-id: 82028b0958c37d63b8a80882196295be4aebecb4
This commit is contained in:
parent
c8bb422882
commit
d5a6152582
@ -236,11 +236,11 @@ static void collectNonTextDescendants(RCTText *view, NSMutableArray *nonTextDesc
|
||||
|
||||
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
|
||||
{
|
||||
if (action == @selector(copy:)) {
|
||||
if (_selectable && action == @selector(copy:)) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
return [super canPerformAction:action withSender:sender];
|
||||
|
||||
return [self.nextResponder canPerformAction:action withSender:sender];
|
||||
}
|
||||
|
||||
- (void)copy:(id)sender
|
||||
|
Loading…
x
Reference in New Issue
Block a user