Skip to content

Commit

Permalink
Merge pull request #38454 from Krishna2323/krishna2323/issue/37770
Browse files Browse the repository at this point in the history
fix: Workspace - Error message is left and bottom aligned in WS menus.
  • Loading branch information
Gonals authored Mar 26, 2024
2 parents 4c9cdfa + e89a1e4 commit c8c6d9b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function BaseListItem<TItem extends ListItem>({
item,
pressableStyle,
wrapperStyle,
containerStyle,
selectMultipleStyle,
isDisabled = false,
shouldPreventDefaultFocusOnSelectRow = false,
Expand Down Expand Up @@ -62,6 +63,7 @@ function BaseListItem<TItem extends ListItem>({
pendingAction={pendingAction}
errors={errors}
errorRowStyles={styles.ph5}
style={containerStyle}
>
<PressableWithFeedback
// eslint-disable-next-line react/jsx-props-no-spreading
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectionList/TableListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function TableListItem({
item={item}
pressableStyle={[[styles.selectionListPressableItemWrapper, item.isSelected && styles.activeComponentBG, isFocused && styles.sidebarLinkActive]]}
wrapperStyle={[styles.flexRow, styles.flex1, styles.justifyContentBetween, styles.userSelectNone, styles.alignItemsCenter]}
containerStyle={styles.mb3}
selectMultipleStyle={[StyleUtils.getCheckboxContainerStyle(20), StyleUtils.getMultiselectListStyles(!!item.isSelected, !!item.isDisabled)]}
isFocused={isFocused}
isDisabled={isDisabled}
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type CommonListItemProps<TItem> = {
/** Styles for the wrapper view */
wrapperStyle?: StyleProp<ViewStyle>;

/** Styles for the container view */
containerStyle?: StyleProp<ViewStyle>;

/** Styles for the checkbox wrapper view if select multiple option is on */
selectMultipleStyle?: StyleProp<ViewStyle>;

Expand Down
35 changes: 18 additions & 17 deletions src/pages/workspace/WorkspacesListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,22 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, r
}

return (
<PressableWithoutFeedback
role={CONST.ROLE.BUTTON}
accessibilityLabel="row"
style={[styles.mh5, styles.mb3]}
disabled={item.disabled}
onPress={item.action}
<OfflineWithFeedback
key={`${item.title}_${index}`}
pendingAction={item.pendingAction}
errorRowStyles={styles.ph5}
onClose={item.dismissError}
errors={item.errors}
style={styles.mb3}
>
{({hovered}) => (
<OfflineWithFeedback
key={`${item.title}_${index}`}
pendingAction={item.pendingAction}
errorRowStyles={styles.ph5}
onClose={item.dismissError}
errors={item.errors}
>
<PressableWithoutFeedback
role={CONST.ROLE.BUTTON}
accessibilityLabel="row"
style={[styles.mh5]}
disabled={item.disabled}
onPress={item.action}
>
{({hovered}) => (
<WorkspacesListRow
title={item.title}
menuItems={threeDotsMenuItems}
Expand All @@ -209,9 +210,9 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, r
brickRoadIndicator={item.brickRoadIndicator}
shouldDisableThreeDotsMenu={item.disabled}
/>
</OfflineWithFeedback>
)}
</PressableWithoutFeedback>
)}
</PressableWithoutFeedback>
</OfflineWithFeedback>
);
},
[isLessThanMediumScreen, styles.mb3, styles.mh5, styles.ph5, styles.hoveredComponentBG, translate],
Expand Down
1 change: 0 additions & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4314,7 +4314,6 @@ const styles = (theme: ThemeColors) =>
paddingHorizontal: 16,
paddingVertical: 16,
marginHorizontal: 20,
marginBottom: 12,
backgroundColor: theme.highlightBG,
borderRadius: 8,
},
Expand Down

0 comments on commit c8c6d9b

Please sign in to comment.