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

Ignoring invalid text style warnings #17908

Merged
merged 2 commits into from
Apr 26, 2023
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
8 changes: 3 additions & 5 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,10 @@ function getNavigationDrawerType(isSmallScreenWidth) {
*/
function getZoomCursorStyle(isZoomed, isDragging) {
if (!isZoomed) {
return {cursor: 'zoom-in'};
return styles.cursorZoomIn;
}

return {
cursor: isDragging ? 'grabbing' : 'zoom-out',
};
return isDragging ? styles.cursorGrabbing : styles.cursorZoomOut;
}

/**
Expand Down Expand Up @@ -544,7 +542,7 @@ function getReportActionItemStyle(isHovered = false, isLoading = false) {
// Warning: Setting this to a non-transparent color will cause unread indicator to break on Android
: colors.transparent,
opacity: isLoading ? 0.5 : 1,
cursor: 'initial',
...styles.cursorInitial,
};
}

Expand Down
46 changes: 13 additions & 33 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import pointerEventsNone from './pointerEventsNone';
import pointerEventsAuto from './pointerEventsAuto';
import overflowXHidden from './overflowXHidden';
import CONST from '../CONST';
import cursor from './utilities/cursor';
import userSelect from './utilities/userSelect';

const picker = {
backgroundColor: themeColors.transparent,
Expand Down Expand Up @@ -157,6 +159,8 @@ const styles = {
...wordBreak,
...whiteSpace,
...writingDirection,
...cursor,
...userSelect,
...themeColors,

rateCol: {
Expand Down Expand Up @@ -628,8 +632,8 @@ const styles = {
appearance: 'none',
height: 26,
opacity: 1,
cursor: 'pointer',
backgroundColor,
...cursor.cursorPointer,
},
inputAndroid: {
fontFamily: fontFamily.EXP_NEUE,
Expand Down Expand Up @@ -941,7 +945,7 @@ const styles = {

inputWeb: {
appearance: 'none',
cursor: disabled ? 'not-allowed' : 'pointer',
...(disabled ? cursor.cursorDisabled : cursor.cursorPointer),
...picker,
backgroundColor,
},
Expand Down Expand Up @@ -1342,8 +1346,7 @@ const styles = {
// Starting version 6.3.2 @react-navigation/drawer adds "user-select: none;" to its container.
// We add user-select-auto to the inner component to prevent incorrect triple-click text selection.
// For further explanation see - https://github.com/Expensify/App/pull/12730/files#r1022883823
userSelect: 'text',
WebkitUserSelect: 'text',
...userSelect.userSelectText,
},

appContentHeader: {
Expand Down Expand Up @@ -1438,7 +1441,7 @@ const styles = {
fontFamily: fontFamily.EXP_NEUE,
lineHeight: variables.lineHeightXLarge,
maxWidth: '100%',
cursor: 'auto',
...cursor.cursorAuto,
...whiteSpace.preWrap,
...wordBreak.breakWord,
},
Expand Down Expand Up @@ -1661,8 +1664,7 @@ const styles = {
},

navigationModalOverlay: {
userSelect: 'none',
WebkitUserSelect: 'none',
...userSelect.userSelectNone,
position: 'absolute',
width: '100%',
height: '100%',
Expand Down Expand Up @@ -2177,7 +2179,7 @@ const styles = {
flexDirection: 'row',
alignItems: 'center',
zIndex: 1,
cursor: 'default',
...cursor.cursorDefault,
},

unreadIndicatorLine: {
Expand Down Expand Up @@ -2233,9 +2235,9 @@ const styles = {
attachmentModalArrowsContainer: {
display: 'flex',
justifyContent: 'center',
cursor: 'unset',
height: '100%',
width: '100%',
...cursor.cursorUnset,
},

leftAttachmentArrow: {
Expand Down Expand Up @@ -2499,23 +2501,11 @@ const styles = {
marginVertical: 4,
},

cursorDefault: {
cursor: 'default',
},

cursorDisabled: {
cursor: 'not-allowed',
},

noSelect: {
boxShadow: 'none',
outline: 'none',
},

cursorPointer: {
cursor: 'pointer',
},

fullscreenCard: {
position: 'absolute',
left: 0,
Expand Down Expand Up @@ -2876,7 +2866,7 @@ const styles = {
alignItems: 'center',
justifyContent: 'center',
backgroundColor: themeColors.imageCropBackgroundColor,
cursor: 'move',
...cursor.cursorMove,
},

sliderKnobTooltipView: {
Expand All @@ -2892,7 +2882,7 @@ const styles = {
width: variables.sliderKnobSize,
borderRadius: variables.sliderKnobSize / 2,
left: -(variables.sliderKnobSize / 2),
cursor: 'pointer',
...cursor.cursorPointer,
},

sliderBar: {
Expand All @@ -2903,16 +2893,6 @@ const styles = {
justifyContent: 'center',
},

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

userSelectNone: {
userSelect: 'none',
WebkitUserSelect: 'none',
},

screenCenteredContainer: {
flex: 1,
justifyContent: 'center',
Expand Down
32 changes: 32 additions & 0 deletions src/styles/utilities/cursor/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default {
cursorDefault: {
cursor: 'default',
},
cursorDisabled: {
cursor: 'not-allowed',
},
cursorPointer: {
cursor: 'pointer',
},
cursorMove: {
cursor: 'move',
},
cursorUnset: {
cursor: 'unset',
},
cursorAuto: {
cursor: 'auto',
},
cursorZoomIn: {
cursor: 'zoom-in',
},
cursorGrabbing: {
cursor: 'grabbing',
},
cursorZoomOut: {
cursor: 'zoom-out',
},
cursorInitial: {
cursor: 'initial',
},
};
12 changes: 12 additions & 0 deletions src/styles/utilities/cursor/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
cursorDefault: {},
cursorDisabled: {},
cursorPointer: {},
cursorMove: {},
cursorUnset: {},
cursorAuto: {},
cursorZoomIn: {},
cursorGrabbing: {},
cursorZoomOut: {},
cursorInitial: {},
};
10 changes: 10 additions & 0 deletions src/styles/utilities/userSelect/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
userSelectText: {
userSelect: 'text',
WebkitUserSelect: 'text',
},
userSelectNone: {
userSelect: 'none',
WebkitUserSelect: 'none',
},
};
8 changes: 8 additions & 0 deletions src/styles/utilities/userSelect/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
userSelectText: {
userSelect: 'text',
},
userSelectNone: {
userSelect: 'none',
},
};