react-native-ui-lib 7.38.1-snapshot.6311 → 7.38.1-snapshot.6314

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,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.38.1-snapshot.6311",
3
+ "version": "7.38.1-snapshot.6314",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -12,7 +12,7 @@
12
12
  {
13
13
  "name": "animate",
14
14
  "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).",
16
16
  "default": "false"
17
17
  },
18
18
  {"name": "backgroundColor", "type": "string", "description": "Background color for Avatar"},
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, TextProps, AccessibilityProps } from 'react-native';
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'> & Pick<TextProps, 'ellipsizeMode'> & PropsWithChildren<{
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"> & Pick<TextProps, "ellipsizeMode"> & {
136
+ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & {
137
137
  /**
138
138
  * Adds fade in animation when Avatar image loads
139
139
  */
@@ -162,6 +162,9 @@ 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
+ */
165
168
  sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
166
169
  assetName?: string | undefined;
167
170
  assetGroup?: string | undefined;
@@ -259,7 +262,7 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
259
262
  children?: React.ReactNode;
260
263
  } & React.RefAttributes<any>>;
261
264
  export { Avatar };
262
- declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & Pick<TextProps, "ellipsizeMode"> & {
265
+ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "accessibilityLabel"> & {
263
266
  /**
264
267
  * Adds fade in animation when Avatar image loads
265
268
  */
@@ -288,6 +291,9 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
288
291
  * Image props object
289
292
  */
290
293
  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
+ */
291
297
  sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
292
298
  assetName?: string | undefined;
293
299
  assetGroup?: string | undefined;
@@ -16,6 +16,7 @@ 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";
19
20
  export let BadgePosition = /*#__PURE__*/function (BadgePosition) {
20
21
  BadgePosition["TOP_RIGHT"] = "TOP_RIGHT";
21
22
  BadgePosition["TOP_LEFT"] = "TOP_LEFT";
@@ -55,7 +56,6 @@ const Avatar = forwardRef((props, ref) => {
55
56
  useAutoColors,
56
57
  autoColorsConfig,
57
58
  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) ? AnimatedImage : Image;
153
+ const ImageContainer = animate && !isSvg(source) && !Constants.isWeb ? 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} ellipsizeMode={ellipsizeMode} style={textStyle} testID={`${testID}.label`}>
181
+ {!_isUndefined(text) && <Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
182
182
  {text}
183
183
  </Text>}
184
184
  </View>
@@ -194,8 +194,7 @@ const styles = StyleSheet.create({
194
194
  ...StyleSheet.absoluteFillObject,
195
195
  alignItems: 'center',
196
196
  justifyContent: 'center',
197
- borderRadius: BorderRadiuses.br100,
198
- overflow: 'hidden'
197
+ borderRadius: BorderRadiuses.br100
199
198
  },
200
199
  initialsContainerWithInset: {
201
200
  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
- return this.props.size || 20;
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;