react-native-ui-lib 7.38.1-snapshot.6311 → 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle,
|
|
2
|
+
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, AccessibilityProps } from 'react-native';
|
|
3
3
|
import { BadgeProps } from '../badge';
|
|
4
4
|
import { ImageProps } from '../image';
|
|
5
5
|
import { AnimatedImageProps } from '../animatedImage';
|
|
@@ -23,7 +23,7 @@ export type AutoColorsProps = {
|
|
|
23
23
|
*/
|
|
24
24
|
defaultColor?: string;
|
|
25
25
|
};
|
|
26
|
-
export type AvatarProps = Pick<AccessibilityProps, 'accessibilityLabel'> &
|
|
26
|
+
export type AvatarProps = Pick<AccessibilityProps, 'accessibilityLabel'> & PropsWithChildren<{
|
|
27
27
|
/**
|
|
28
28
|
* Adds fade in animation when Avatar image loads
|
|
29
29
|
*/
|
|
@@ -133,7 +133,7 @@ interface Statics {
|
|
|
133
133
|
* @image: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Avatar/Avarat_1.png?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Avatar/Avarat_2.png?raw=true
|
|
134
134
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/AvatarsScreen.tsx
|
|
135
135
|
*/
|
|
136
|
-
declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> &
|
|
136
|
+
declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & {
|
|
137
137
|
/**
|
|
138
138
|
* Adds fade in animation when Avatar image loads
|
|
139
139
|
*/
|
|
@@ -166,23 +166,25 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
166
166
|
assetName?: string | undefined;
|
|
167
167
|
assetGroup?: string | undefined;
|
|
168
168
|
tintColor?: string | undefined;
|
|
169
|
-
supportRTL?: boolean | undefined;
|
|
170
|
-
* Background color for Avatar
|
|
171
|
-
*/
|
|
169
|
+
supportRTL?: boolean | undefined;
|
|
172
170
|
cover?: boolean | undefined;
|
|
173
171
|
aspectRatio?: number | undefined;
|
|
174
|
-
overlayType?: string | undefined;
|
|
175
|
-
* Image props object
|
|
176
|
-
*/
|
|
172
|
+
overlayType?: string | undefined;
|
|
177
173
|
overlayIntensity?: import("../overlay").OverlayIntensityType | undefined;
|
|
178
174
|
overlayColor?: string | undefined;
|
|
179
175
|
customOverlayContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
180
176
|
errorSource?: import("../image").ImageSourceType;
|
|
181
|
-
imageId?: string | undefined;
|
|
177
|
+
imageId?: string | undefined; /**
|
|
178
|
+
* Listener-callback for when an image's (uri) loading
|
|
179
|
+
* fails (equiv. to Image.onError()).
|
|
180
|
+
*/
|
|
182
181
|
useBackgroundContainer?: boolean | undefined;
|
|
183
182
|
width?: string | number | undefined;
|
|
184
183
|
height?: string | number | undefined;
|
|
185
|
-
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
|
+
*/
|
|
186
188
|
} & AnimatedImageProps> | undefined;
|
|
187
189
|
/**
|
|
188
190
|
* Image style object used to pass additional style props
|
|
@@ -259,7 +261,7 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
259
261
|
children?: React.ReactNode;
|
|
260
262
|
} & React.RefAttributes<any>>;
|
|
261
263
|
export { Avatar };
|
|
262
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> &
|
|
264
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & {
|
|
263
265
|
/**
|
|
264
266
|
* Adds fade in animation when Avatar image loads
|
|
265
267
|
*/
|
|
@@ -292,23 +294,25 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
|
|
|
292
294
|
assetName?: string | undefined;
|
|
293
295
|
assetGroup?: string | undefined;
|
|
294
296
|
tintColor?: string | undefined;
|
|
295
|
-
supportRTL?: boolean | undefined;
|
|
296
|
-
* Background color for Avatar
|
|
297
|
-
*/
|
|
297
|
+
supportRTL?: boolean | undefined;
|
|
298
298
|
cover?: boolean | undefined;
|
|
299
299
|
aspectRatio?: number | undefined;
|
|
300
|
-
overlayType?: string | undefined;
|
|
301
|
-
* Image props object
|
|
302
|
-
*/
|
|
300
|
+
overlayType?: string | undefined;
|
|
303
301
|
overlayIntensity?: import("../overlay").OverlayIntensityType | undefined;
|
|
304
302
|
overlayColor?: string | undefined;
|
|
305
303
|
customOverlayContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
306
304
|
errorSource?: import("../image").ImageSourceType;
|
|
307
|
-
imageId?: string | undefined;
|
|
305
|
+
imageId?: string | undefined; /**
|
|
306
|
+
* Listener-callback for when an image's (uri) loading
|
|
307
|
+
* fails (equiv. to Image.onError()).
|
|
308
|
+
*/
|
|
308
309
|
useBackgroundContainer?: boolean | undefined;
|
|
309
310
|
width?: string | number | undefined;
|
|
310
311
|
height?: string | number | undefined;
|
|
311
|
-
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
|
+
*/
|
|
312
316
|
} & AnimatedImageProps> | undefined;
|
|
313
317
|
/**
|
|
314
318
|
* Image style object used to pass additional style props
|
|
@@ -55,7 +55,6 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
55
55
|
useAutoColors,
|
|
56
56
|
autoColorsConfig,
|
|
57
57
|
containerStyle,
|
|
58
|
-
ellipsizeMode = 'clip',
|
|
59
58
|
onPress,
|
|
60
59
|
children
|
|
61
60
|
} = themeProps;
|
|
@@ -178,7 +177,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
178
177
|
const Container = onPress ? TouchableOpacity : View;
|
|
179
178
|
return <Container style={_containerStyle} ref={ref} testID={testID} onPress={onPress} accessible={!_isUndefined(onPress)} accessibilityLabel={'Avatar'} accessibilityRole={onPress ? 'button' : 'image'} hitSlop={onPress ? hitTargetPadding : undefined} {...accessibilityProps}>
|
|
180
179
|
<View testID={`${testID}.container`} style={textContainerStyle}>
|
|
181
|
-
{!_isUndefined(text) && <Text numberOfLines={1}
|
|
180
|
+
{!_isUndefined(text) && <Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
|
|
182
181
|
{text}
|
|
183
182
|
</Text>}
|
|
184
183
|
</View>
|
|
@@ -194,8 +193,7 @@ const styles = StyleSheet.create({
|
|
|
194
193
|
...StyleSheet.absoluteFillObject,
|
|
195
194
|
alignItems: 'center',
|
|
196
195
|
justifyContent: 'center',
|
|
197
|
-
borderRadius: BorderRadiuses.br100
|
|
198
|
-
overflow: 'hidden'
|
|
196
|
+
borderRadius: BorderRadiuses.br100
|
|
199
197
|
},
|
|
200
198
|
initialsContainerWithInset: {
|
|
201
199
|
top: 1,
|
|
@@ -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;
|