Skip to content

Commit

Permalink
Make text non-selectable on web too (#1252)
Browse files Browse the repository at this point in the history
* Make text non-selectable on web too

Context: necolas/react-native-web#1741

* Add default of selectable=false to have the same behaviour across platforms

* Fix prettier of icon-button.js

Co-authored-by: Joel Arvidsson <[email protected]>
  • Loading branch information
RichardLindhout and oblador authored Feb 13, 2022
1 parent bb5bd45 commit 217d26d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/create-icon-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function createIconSet(
props.ref = this.handleRef;

return (
<Text {...props}>
<Text selectable={false} {...props}>
{glyph}
{children}
</Text>
Expand Down
4 changes: 3 additions & 1 deletion lib/icon-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export default function createIconButtonComponent(Icon) {
<View style={[styles.container, blockStyle, style]} {...props}>
<Icon {...iconProps} />
{typeof children === 'string' ? (
<Text style={[styles.text, colorStyle]}>{children}</Text>
<Text style={[styles.text, colorStyle]} selectable={false}>
{children}
</Text>
) : (
children
)}
Expand Down

0 comments on commit 217d26d

Please sign in to comment.