Skip to content
Closed
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: 6 additions & 2 deletions src/components/SelectionList/UserListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from 'react';
import React, {useMemo} from 'react';
import {View} from 'react-native';
import SubscriptAvatar from '@components/SubscriptAvatar';
import TextWithTooltip from '@components/TextWithTooltip';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import type {UserListItemProps} from './types';

function UserListItem({item, textStyles, alternateTextStyles, showTooltip, style}: UserListItemProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const containerStyles = useMemo(() => StyleUtils.getUserListItemStyles(styles), [StyleUtils, styles]);

return (
<>
{!!item.icons && (
Expand All @@ -16,7 +20,7 @@ function UserListItem({item, textStyles, alternateTextStyles, showTooltip, style
showTooltip={showTooltip}
/>
)}
<View style={[styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStretch, styles.optionRow]}>
<View style={containerStyles}>
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={item.text}
Expand Down
5 changes: 5 additions & 0 deletions src/styles/utils/getUserListItemStyles/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type GetContextMenuItemStyle from './types';

const getUserListItemStyles: GetContextMenuItemStyle = (styles) => [styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStretch, styles.optionRow];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a baseStyles.ts file with all the common styles to make it clear what's different between web and mobile. I think in general we have developed too big an appetite for platform differences in our codebase.


export default getUserListItemStyles;
5 changes: 5 additions & 0 deletions src/styles/utils/getUserListItemStyles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type GetUserListItemStyles from './types';

const getUserListItemStyles: GetUserListItemStyles = (styles) => [styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStart, styles.optionRow];

export default getUserListItemStyles;
6 changes: 6 additions & 0 deletions src/styles/utils/getUserListItemStyles/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type {ViewStyle} from 'react-native';
import type {ThemeStyles} from '@styles/index';

type GetUserListItemStyles = (styles: ThemeStyles) => ViewStyle[];

export default GetUserListItemStyles;
2 changes: 2 additions & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import createReportActionContextMenuStyleUtils from './generators/ReportActionCo
import createTooltipStyleUtils from './generators/TooltipStyleUtils';
import getContextMenuItemStyles from './getContextMenuItemStyles';
import getNavigationModalCardStyle from './getNavigationModalCardStyles';
import getUserListItemStyles from './getUserListItemStyles';
import {compactContentContainerStyles} from './optionRowStyles';
import positioning from './positioning';
import type {
Expand Down Expand Up @@ -1084,6 +1085,7 @@ const staticStyleUtils = {
getCardStyles,
getOpacityStyle,
getMultiGestureCanvasContainerStyle,
getUserListItemStyles,
};

const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
Expand Down