Skip to content
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

fix user select style on anchor tag #8757

Merged
merged 3 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as ReportActionContextMenu from '../../../pages/home/report/ContextMenu
import * as ContextMenuActions from '../../../pages/home/report/ContextMenu/ContextMenuActions';
import AttachmentView from '../../AttachmentView';
import fileDownload from '../../../libs/fileDownload';
import canUseTouchScreen from '../../../libs/canUseTouchscreen';
import styles from '../../../styles/styles';

/*
* This is a default anchor component for regular links.
Expand Down Expand Up @@ -38,6 +40,8 @@ class BaseAnchorForCommentsOnly extends React.Component {
render() {
let linkRef;
const rest = _.omit(this.props, _.keys(propTypes));
const defaultTextStyle = canUseTouchScreen() || this.props.isSmallScreenWidth ? {} : styles.userSelectText;

return (
this.props.isAttachment
? (
Expand Down Expand Up @@ -72,7 +76,7 @@ class BaseAnchorForCommentsOnly extends React.Component {
>
<Text
ref={el => linkRef = el}
style={StyleSheet.flatten(this.props.style)}
style={StyleSheet.flatten([this.props.style, defaultTextStyle])}
accessibilityRole="link"
href={this.props.href}
hrefAttrs={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const customHTMLElementModels = {
}),
};

const defaultViewProps = {style: {alignItems: 'flex-start'}};
const defaultViewProps = {style: [styles.alignItemsStart, styles.userSelectText]};

// We are using the explicit composite architecture for performance gains.
// Configuration for RenderHTML is handled in a top-level component providing
Expand Down
4 changes: 4 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,10 @@ const styles = {
closeAccountMessageInput: {
height: 153,
},

userSelectText: {
userSelect: 'text',
},
};

export default styles;