react-native-ui-lib 7.38.1-snapshot.6307 → 7.38.1-snapshot.6312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -162,30 +162,29 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
162
162
|
* Image props object
|
|
163
163
|
*/
|
|
164
164
|
imageProps?: Partial<Omit<import("react-native").ImageProps, "source"> & Pick<import("react-native").ImageBackgroundProps, "imageStyle"> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & import("../..").RecorderProps & {
|
|
165
|
-
/**
|
|
166
|
-
* Avatar colors to be used when useAutoColors is true
|
|
167
|
-
*/
|
|
168
165
|
sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
|
|
169
166
|
assetName?: string | undefined;
|
|
170
167
|
assetGroup?: string | undefined;
|
|
171
168
|
tintColor?: string | undefined;
|
|
172
|
-
supportRTL?: boolean | undefined;
|
|
173
|
-
* Background color for Avatar
|
|
174
|
-
*/
|
|
169
|
+
supportRTL?: boolean | undefined;
|
|
175
170
|
cover?: boolean | undefined;
|
|
176
171
|
aspectRatio?: number | undefined;
|
|
177
|
-
overlayType?: string | undefined;
|
|
178
|
-
* Image props object
|
|
179
|
-
*/
|
|
172
|
+
overlayType?: string | undefined;
|
|
180
173
|
overlayIntensity?: import("../overlay").OverlayIntensityType | undefined;
|
|
181
174
|
overlayColor?: string | undefined;
|
|
182
175
|
customOverlayContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
183
176
|
errorSource?: import("../image").ImageSourceType;
|
|
184
|
-
imageId?: string | undefined;
|
|
177
|
+
imageId?: string | undefined; /**
|
|
178
|
+
* Listener-callback for when an image's (uri) loading
|
|
179
|
+
* fails (equiv. to Image.onError()).
|
|
180
|
+
*/
|
|
185
181
|
useBackgroundContainer?: boolean | undefined;
|
|
186
182
|
width?: string | number | undefined;
|
|
187
183
|
height?: string | number | undefined;
|
|
188
|
-
source: import("../image").ImageSourceType;
|
|
184
|
+
source: import("../image").ImageSourceType; /**
|
|
185
|
+
* Hash the name (or label) to get a color, so each name will have a specific color.
|
|
186
|
+
* Default is false.
|
|
187
|
+
*/
|
|
189
188
|
} & AnimatedImageProps> | undefined;
|
|
190
189
|
/**
|
|
191
190
|
* Image style object used to pass additional style props
|
|
@@ -291,30 +290,29 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
|
|
|
291
290
|
* Image props object
|
|
292
291
|
*/
|
|
293
292
|
imageProps?: Partial<Omit<import("react-native").ImageProps, "source"> & Pick<import("react-native").ImageBackgroundProps, "imageStyle"> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & import("../..").RecorderProps & {
|
|
294
|
-
/**
|
|
295
|
-
* Avatar colors to be used when useAutoColors is true
|
|
296
|
-
*/
|
|
297
293
|
sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
|
|
298
294
|
assetName?: string | undefined;
|
|
299
295
|
assetGroup?: string | undefined;
|
|
300
296
|
tintColor?: string | undefined;
|
|
301
|
-
supportRTL?: boolean | undefined;
|
|
302
|
-
* Background color for Avatar
|
|
303
|
-
*/
|
|
297
|
+
supportRTL?: boolean | undefined;
|
|
304
298
|
cover?: boolean | undefined;
|
|
305
299
|
aspectRatio?: number | undefined;
|
|
306
|
-
overlayType?: string | undefined;
|
|
307
|
-
* Image props object
|
|
308
|
-
*/
|
|
300
|
+
overlayType?: string | undefined;
|
|
309
301
|
overlayIntensity?: import("../overlay").OverlayIntensityType | undefined;
|
|
310
302
|
overlayColor?: string | undefined;
|
|
311
303
|
customOverlayContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
312
304
|
errorSource?: import("../image").ImageSourceType;
|
|
313
|
-
imageId?: string | undefined;
|
|
305
|
+
imageId?: string | undefined; /**
|
|
306
|
+
* Listener-callback for when an image's (uri) loading
|
|
307
|
+
* fails (equiv. to Image.onError()).
|
|
308
|
+
*/
|
|
314
309
|
useBackgroundContainer?: boolean | undefined;
|
|
315
310
|
width?: string | number | undefined;
|
|
316
311
|
height?: string | number | undefined;
|
|
317
|
-
source: import("../image").ImageSourceType;
|
|
312
|
+
source: import("../image").ImageSourceType; /**
|
|
313
|
+
* Hash the name (or label) to get a color, so each name will have a specific color.
|
|
314
|
+
* Default is false.
|
|
315
|
+
*/
|
|
318
316
|
} & AnimatedImageProps> | undefined;
|
|
319
317
|
/**
|
|
320
318
|
* Image style object used to pass additional style props
|
|
@@ -16,7 +16,6 @@ import AnimatedImage from "../animatedImage";
|
|
|
16
16
|
import * as AvatarHelper from "../../helpers/AvatarHelper";
|
|
17
17
|
import { useThemeProps } from "../../hooks";
|
|
18
18
|
import { isSvg } from "../../utils/imageUtils";
|
|
19
|
-
import Constants from "../../commons/Constants";
|
|
20
19
|
export let BadgePosition = /*#__PURE__*/function (BadgePosition) {
|
|
21
20
|
BadgePosition["TOP_RIGHT"] = "TOP_RIGHT";
|
|
22
21
|
BadgePosition["TOP_LEFT"] = "TOP_LEFT";
|
|
@@ -150,7 +149,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
150
149
|
const renderImage = () => {
|
|
151
150
|
if (source !== undefined) {
|
|
152
151
|
// Looks like reanimated does not support SVG
|
|
153
|
-
const ImageContainer = animate && !isSvg(source)
|
|
152
|
+
const ImageContainer = animate && !isSvg(source) ? AnimatedImage : Image;
|
|
154
153
|
return <ImageContainer style={_imageStyle} source={source} onLoadStart={onImageLoadStart} onLoadEnd={onImageLoadEnd} onError={onImageLoadError} testID={`${testID}.image`} width={size} height={size} containerStyle={_baseContainerStyle} {...imageProps} />;
|
|
155
154
|
}
|
|
156
155
|
};
|
|
@@ -10,6 +10,8 @@ import Image from "../image";
|
|
|
10
10
|
import View from "../view";
|
|
11
11
|
import Text from "../text";
|
|
12
12
|
const LABEL_FORMATTER_VALUES = [1, 2, 3, 4];
|
|
13
|
+
const DEFAULT_PIMPLE_SIZE = 10;
|
|
14
|
+
const DEFAULT_BADGE_SIZE = 20;
|
|
13
15
|
/**
|
|
14
16
|
* @description: Round colored badge, typically used to show a number
|
|
15
17
|
* @extends: View
|
|
@@ -37,7 +39,14 @@ class Badge extends PureComponent {
|
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
get size() {
|
|
40
|
-
|
|
42
|
+
const {
|
|
43
|
+
size,
|
|
44
|
+
label
|
|
45
|
+
} = this.props;
|
|
46
|
+
if (size !== undefined) {
|
|
47
|
+
return size;
|
|
48
|
+
}
|
|
49
|
+
return label === undefined ? DEFAULT_PIMPLE_SIZE : DEFAULT_BADGE_SIZE;
|
|
41
50
|
}
|
|
42
51
|
isSmallBadge() {
|
|
43
52
|
return this.size <= 16;
|