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: solve missing avatar workspace logo issue #21657

Merged
merged 6 commits into from
Jul 3, 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
19 changes: 12 additions & 7 deletions src/components/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ function Avatar(props) {
const isWorkspace = props.type === CONST.ICON_TYPE_WORKSPACE;
const iconSize = StyleUtils.getAvatarSize(props.size);

const imageStyle = props.imageStyles ? [StyleUtils.getAvatarStyle(props.size), ...props.imageStyles, StyleUtils.getAvatarBorderRadius(props.size, props.type)] : undefined;
const imageStyle =
props.imageStyles && props.imageStyles.length
? [StyleUtils.getAvatarStyle(props.size), ...props.imageStyles, StyleUtils.getAvatarBorderRadius(props.size, props.type)]
: [StyleUtils.getAvatarStyle(props.size), styles.noBorderRadius];

const iconStyle = props.imageStyles ? [StyleUtils.getAvatarStyle(props.size), styles.bgTransparent, ...props.imageStyles] : undefined;
const iconStyle = props.imageStyles && props.imageStyles.length ? [StyleUtils.getAvatarStyle(props.size), styles.bgTransparent, ...props.imageStyles] : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Previously, Avatar component used to apply this style by default to all View at line 107 but and similarly the imageStyles was applied to image at line 110. We migrated imageStyle properly but not the wrapper View style. Now, iconStyle will be undefined by default causing issues. as mentioned above.

Is there any issues if I revert the iconStyle to be same as before.

@rushatgabhane

Copy link
Member

Choose a reason for hiding this comment

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

I am waiting on this question to move forward on a PR. Looking forward to it. @rushatgabhane @developerdavi

Copy link
Member

Choose a reason for hiding this comment

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

@parasharrajat feel free to revert. it should be fine


const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(props.name).fill : props.fill;
const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(props.name) : props.fallbackIcon;
Expand All @@ -101,11 +104,13 @@ function Avatar(props) {
/>
</View>
) : (
<Image
source={{uri: props.source}}
style={imageStyle}
onError={() => setImageError(true)}
/>
<View style={[iconStyle, StyleUtils.getAvatarBorderStyle(props.size, props.type), ...props.iconAdditionalStyles]}>
<Image
source={{uri: props.source}}
style={imageStyle}
onError={() => setImageError(true)}
/>
</View>
)}
</View>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/SubscriptAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ function SubscriptAvatar(props) {
<Tooltip text={props.secondaryTooltip}>
<View>
<Avatar
imageStyles={null}
containerStyles={[props.size === CONST.AVATAR_SIZE.SMALL ? styles.secondAvatarSubscriptCompact : styles.secondAvatarSubscript]}
iconAdditionalStyles={[
StyleUtils.getAvatarBorderWidth(props.size === CONST.AVATAR_SIZE.SMALL ? CONST.AVATAR_SIZE.SMALL_SUBSCRIPT : CONST.AVATAR_SIZE.SUBSCRIPT),
Expand Down
4 changes: 4 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,10 @@ const styles = {
marginVertical: 1,
},

noBorderRadius: {
borderRadius: 0,
},

noRightBorderRadius: {
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
Expand Down