Skip to content

Commit

Permalink
Merge pull request #36395 from ZhenjaHorbach/clicking-on-avatar-of-in…
Browse files Browse the repository at this point in the history
…vited-workspace-does-not-open-avatar-in-full-screen-view

Fix bug with Clicking on avatar of invited workspace does not open avatar in full screen view
  • Loading branch information
bondydaa authored Feb 13, 2024
2 parents 67dd595 + 2b6abfe commit 023d62c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/components/AvatarWithImagePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ const propTypes = {
horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)),
vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)),
}),

/** Allows to open an image without Attachment Picker. */
enablePreview: PropTypes.bool,
};

const defaultProps = {
Expand Down Expand Up @@ -127,6 +130,7 @@ const defaultProps = {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
},
enablePreview: false,
};

function AvatarWithImagePicker({
Expand All @@ -152,6 +156,7 @@ function AvatarWithImagePicker({
avatarStyle,
disabled,
onViewPhotoPress,
enablePreview,
}) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -330,10 +335,16 @@ function AvatarWithImagePicker({
text={translate('avatarWithImagePicker.editImage')}
>
<PressableWithoutFeedback
onPress={() => setIsMenuVisible((prev) => !prev)}
onPress={() => {
if (disabled && enablePreview && onViewPhotoPress) {
onViewPhotoPress();
return;
}
setIsMenuVisible((prev) => !prev);
}}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON}
accessibilityLabel={translate('avatarWithImagePicker.editImage')}
disabled={isAvatarCropModalOpen || disabled}
disabled={isAvatarCropModalOpen || (disabled && !enablePreview)}
disabledStyle={disabledStyle}
ref={anchorRef}
>
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspace/WorkspaceAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function WorkspaceAvatar({policy, isLoadingApp = true}: WorkspaceAvatarProps) {
originalFileName={policy?.originalFileName ?? policy?.name ?? ''}
shouldShowNotFoundPage={!Object.keys(policy ?? {}).length && !isLoadingApp}
isLoading={!Object.keys(policy ?? {}).length && !!isLoadingApp}
maybeIcon
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspace/WorkspaceProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function WorkspaceProfilePage({policy, currencyList, route}) {
source={lodashGet(policy, 'avatar')}
size={CONST.AVATAR_SIZE.XLARGE}
avatarStyle={styles.avatarXLarge}
enablePreview
DefaultAvatar={() => (
<Avatar
containerStyles={styles.avatarXLarge}
Expand Down

0 comments on commit 023d62c

Please sign in to comment.