Skip to content

Avatar animate mode not supported on web #3554

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

Merged
merged 2 commits into from
Mar 6, 2025
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
2 changes: 1 addition & 1 deletion src/components/avatar/avatar.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"name": "animate",
"type": "boolean",
"description": "Adds fade in animation when Avatar image loads",
"description": "Adds fade in animation when Avatar image loads. This prop isn't supported on web (will be set to false by default when using web).",
"default": "false"
},
{"name": "backgroundColor", "type": "string", "description": "Background color for Avatar"},
Expand Down
3 changes: 2 additions & 1 deletion src/components/avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import AnimatedImage, {AnimatedImageProps} from '../animatedImage';
import * as AvatarHelper from '../../helpers/AvatarHelper';
import {useThemeProps} from '../../hooks';
import {isSvg} from '../../utils/imageUtils';
import Constants from '../../commons/Constants';

export enum BadgePosition {
TOP_RIGHT = 'TOP_RIGHT',
Expand Down Expand Up @@ -287,7 +288,7 @@ const Avatar = forwardRef<any, AvatarProps>((props: AvatarProps, ref: React.Forw
const renderImage = () => {
if (source !== undefined) {
// Looks like reanimated does not support SVG
const ImageContainer = animate && !isSvg(source) ? AnimatedImage : Image;
const ImageContainer = animate && !isSvg(source) && !Constants.isWeb ? AnimatedImage : Image;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's also update in api.json about this prop that it's not supported on Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, missed that.

return (
<ImageContainer
style={_imageStyle}
Expand Down