react-native-ui-lib 7.38.1-snapshot.6307 → 7.38.1-snapshot.6311
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, AccessibilityProps } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, TextProps, 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'> & PropsWithChildren<{
|
|
26
|
+
export type AvatarProps = Pick<AccessibilityProps, 'accessibilityLabel'> & Pick<TextProps, 'ellipsizeMode'> & 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"> & Pick<TextProps, "ellipsizeMode"> & {
|
|
137
137
|
/**
|
|
138
138
|
* Adds fade in animation when Avatar image loads
|
|
139
139
|
*/
|
|
@@ -162,9 +162,6 @@ 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;
|
|
@@ -262,7 +259,7 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
262
259
|
children?: React.ReactNode;
|
|
263
260
|
} & React.RefAttributes<any>>;
|
|
264
261
|
export { Avatar };
|
|
265
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & {
|
|
262
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & Pick<TextProps, "ellipsizeMode"> & {
|
|
266
263
|
/**
|
|
267
264
|
* Adds fade in animation when Avatar image loads
|
|
268
265
|
*/
|
|
@@ -291,9 +288,6 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
|
|
|
291
288
|
* Image props object
|
|
292
289
|
*/
|
|
293
290
|
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
291
|
sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
|
|
298
292
|
assetName?: string | undefined;
|
|
299
293
|
assetGroup?: string | undefined;
|
|
@@ -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";
|
|
@@ -56,6 +55,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
56
55
|
useAutoColors,
|
|
57
56
|
autoColorsConfig,
|
|
58
57
|
containerStyle,
|
|
58
|
+
ellipsizeMode = 'clip',
|
|
59
59
|
onPress,
|
|
60
60
|
children
|
|
61
61
|
} = themeProps;
|
|
@@ -150,7 +150,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
150
150
|
const renderImage = () => {
|
|
151
151
|
if (source !== undefined) {
|
|
152
152
|
// Looks like reanimated does not support SVG
|
|
153
|
-
const ImageContainer = animate && !isSvg(source)
|
|
153
|
+
const ImageContainer = animate && !isSvg(source) ? AnimatedImage : Image;
|
|
154
154
|
return <ImageContainer style={_imageStyle} source={source} onLoadStart={onImageLoadStart} onLoadEnd={onImageLoadEnd} onError={onImageLoadError} testID={`${testID}.image`} width={size} height={size} containerStyle={_baseContainerStyle} {...imageProps} />;
|
|
155
155
|
}
|
|
156
156
|
};
|
|
@@ -178,7 +178,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
178
178
|
const Container = onPress ? TouchableOpacity : View;
|
|
179
179
|
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
180
|
<View testID={`${testID}.container`} style={textContainerStyle}>
|
|
181
|
-
{!_isUndefined(text) && <Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
|
|
181
|
+
{!_isUndefined(text) && <Text numberOfLines={1} ellipsizeMode={ellipsizeMode} style={textStyle} testID={`${testID}.label`}>
|
|
182
182
|
{text}
|
|
183
183
|
</Text>}
|
|
184
184
|
</View>
|
|
@@ -194,7 +194,8 @@ const styles = StyleSheet.create({
|
|
|
194
194
|
...StyleSheet.absoluteFillObject,
|
|
195
195
|
alignItems: 'center',
|
|
196
196
|
justifyContent: 'center',
|
|
197
|
-
borderRadius: BorderRadiuses.br100
|
|
197
|
+
borderRadius: BorderRadiuses.br100,
|
|
198
|
+
overflow: 'hidden'
|
|
198
199
|
},
|
|
199
200
|
initialsContainerWithInset: {
|
|
200
201
|
top: 1,
|