Skip to content

Commit 90e75c9

Browse files
authored
Avatar animate mode not supported on web (#3554)
* prevent AnimatedImage usage on web platform * Update avatar.api.json to clarify web support for animate prop
1 parent e7f6802 commit 90e75c9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/components/avatar/avatar.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
"name": "animate",
1414
"type": "boolean",
15-
"description": "Adds fade in animation when Avatar image loads",
15+
"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).",
1616
"default": "false"
1717
},
1818
{"name": "backgroundColor", "type": "string", "description": "Background color for Avatar"},

src/components/avatar/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import AnimatedImage, {AnimatedImageProps} from '../animatedImage';
2121
import * as AvatarHelper from '../../helpers/AvatarHelper';
2222
import {useThemeProps} from '../../hooks';
2323
import {isSvg} from '../../utils/imageUtils';
24+
import Constants from '../../commons/Constants';
2425

2526
export enum BadgePosition {
2627
TOP_RIGHT = 'TOP_RIGHT',
@@ -287,7 +288,7 @@ const Avatar = forwardRef<any, AvatarProps>((props: AvatarProps, ref: React.Forw
287288
const renderImage = () => {
288289
if (source !== undefined) {
289290
// Looks like reanimated does not support SVG
290-
const ImageContainer = animate && !isSvg(source) ? AnimatedImage : Image;
291+
const ImageContainer = animate && !isSvg(source) && !Constants.isWeb ? AnimatedImage : Image;
291292
return (
292293
<ImageContainer
293294
style={_imageStyle}

0 commit comments

Comments
 (0)