({
size = defaultSize,
source,
style,
onError,
onLayout,
onLoad,
onLoadEnd,
onLoadStart,
onProgress,
theme: themeOverrides,
testID,
...rest
}: Props)
| 75 | * ``` |
| 76 | */ |
| 77 | const AvatarImage = ({ |
| 78 | size = defaultSize, |
| 79 | source, |
| 80 | style, |
| 81 | onError, |
| 82 | onLayout, |
| 83 | onLoad, |
| 84 | onLoadEnd, |
| 85 | onLoadStart, |
| 86 | onProgress, |
| 87 | theme: themeOverrides, |
| 88 | testID, |
| 89 | ...rest |
| 90 | }: Props) => { |
| 91 | const { colors } = useInternalTheme(themeOverrides); |
| 92 | const { backgroundColor = colors?.primary } = StyleSheet.flatten(style) || {}; |
| 93 | |
| 94 | return ( |
| 95 | <View |
| 96 | style={[ |
| 97 | { |
| 98 | width: size, |
| 99 | height: size, |
| 100 | borderRadius: size / 2, |
| 101 | backgroundColor, |
| 102 | }, |
| 103 | style, |
| 104 | ]} |
| 105 | {...rest} |
| 106 | > |
| 107 | {typeof source === 'function' && source({ size })} |
| 108 | {typeof source !== 'function' && ( |
| 109 | <Image |
| 110 | testID={testID} |
| 111 | source={source} |
| 112 | style={{ width: size, height: size, borderRadius: size / 2 }} |
| 113 | onError={onError} |
| 114 | onLayout={onLayout} |
| 115 | onLoad={onLoad} |
| 116 | onLoadEnd={onLoadEnd} |
| 117 | onLoadStart={onLoadStart} |
| 118 | onProgress={onProgress} |
| 119 | accessibilityIgnoresInvertColors |
| 120 | /> |
| 121 | )} |
| 122 | </View> |
| 123 | ); |
| 124 | }; |
| 125 | |
| 126 | AvatarImage.displayName = 'Avatar.Image'; |
| 127 |
nothing calls this directly
no test coverage detected
searching dependent graphs…