@@ -24,7 +24,6 @@ import Image, {ImageProps} from '../image';
24
24
import AnimatedImage from '../animatedImage' ;
25
25
import * as AvatarHelper from '../../helpers/AvatarHelper' ;
26
26
27
-
28
27
export enum BadgePosition {
29
28
TOP_RIGHT = 'TOP_RIGHT' ,
30
29
TOP_LEFT = 'TOP_LEFT' ,
@@ -49,111 +48,112 @@ export type AutoColorsProps = {
49
48
defaultColor ?: string ;
50
49
} ;
51
50
52
- export type AvatarProps = Pick < AccessibilityProps , 'accessibilityLabel' > & PropsWithChildren < {
53
- /**
54
- * Adds fade in animation when Avatar image loads
55
- */
56
- animate ?: boolean ;
57
- /**
58
- * Background color for Avatar
59
- */
60
- backgroundColor ?: string ;
61
- /**
62
- * Badge location on Avatar
63
- */
64
- badgePosition ?: BadgePosition ;
65
- /**
66
- * Badge props passed down to Badge component
67
- */
68
- badgeProps ?: BadgeProps ;
69
- /**
70
- * Additional spacing styles for the container
71
- */
72
- containerStyle ?: StyleProp < ViewStyle > ;
73
- /**
74
- * The image source (external or assets)
75
- */
76
- source ?: ImageSourcePropType ;
77
- /**
78
- * @deprecated use 'source' prop
79
- */
80
- imageSource ?: ImageSourcePropType ;
81
- /**
82
- * Image props object
83
- */
84
- imageProps ?: ImageProps ;
85
- /**
86
- * Image style object used to pass additional style props
87
- * by components which render image
88
- */
89
- imageStyle ?: ImageStyle ;
90
- /**
91
- * Listener-callback for when an image's (uri) loading
92
- * starts (equiv. to Image.onLoadStart()).
93
- */
94
- onImageLoadStart ?: ImagePropsBase [ 'onLoadStart' ] ;
95
- /**
96
- * Listener-callback for when an image's (uri) loading
97
- * either succeeds or fails (equiv. to Image.onLoadEnd()).
98
- */
99
- onImageLoadEnd ?: ImagePropsBase [ 'onLoadEnd' ] ;
100
- /**
101
- * Listener-callback for when an image's (uri) loading
102
- * fails (equiv. to Image.onError()).
103
- */
104
- onImageLoadError ?: ImagePropsBase [ 'onError' ] ;
105
- /**
106
- * The name of the avatar user.
107
- * If no label is provided, the initials will be generated from the name.
108
- * autoColorsConfig will use the name to create the background color of the Avatar.
109
- */
110
- name ?: string ;
111
- /**
112
- * Hash the name (or label) to get a color, so each name will have a specific color.
113
- * Default is false.
114
- */
115
- useAutoColors ?: boolean ;
116
- /**
117
- * Send this to use the name to infer a backgroundColor
118
- */
119
- autoColorsConfig ?: AutoColorsProps ;
120
- /**
121
- * Label that can represent initials
122
- */
123
- label ?: string ;
124
- /**
125
- * The label color
126
- */
127
- labelColor ?: string ;
128
- /**
129
- * ribbon label to display on the avatar
130
- */
131
- ribbonLabel ?: string ;
132
- /**
133
- * ribbon custom style
134
- */
135
- ribbonStyle ?: StyleProp < ViewStyle > ;
136
- /**
137
- * ribbon label custom style
138
- */
139
- ribbonLabelStyle ?: StyleProp < TextStyle > ;
140
- /**
141
- * Custom ribbon
142
- */
143
- customRibbon ?: JSX . Element ;
144
- /**
145
- * Custom size for the Avatar
146
- */
147
- size : number ;
148
- /**
149
- * Press handler
150
- */
151
- onPress ?: ( props : any ) => void ;
152
- /**
153
- * Used as a testing identifier
154
- */
155
- testID ?: string ;
156
- } > ;
51
+ export type AvatarProps = Pick < AccessibilityProps , 'accessibilityLabel' > &
52
+ PropsWithChildren < {
53
+ /**
54
+ * Adds fade in animation when Avatar image loads
55
+ */
56
+ animate ?: boolean ;
57
+ /**
58
+ * Background color for Avatar
59
+ */
60
+ backgroundColor ?: string ;
61
+ /**
62
+ * Badge location on Avatar
63
+ */
64
+ badgePosition ?: BadgePosition ;
65
+ /**
66
+ * Badge props passed down to Badge component
67
+ */
68
+ badgeProps ?: BadgeProps ;
69
+ /**
70
+ * Additional spacing styles for the container
71
+ */
72
+ containerStyle ?: StyleProp < ViewStyle > ;
73
+ /**
74
+ * The image source (external or assets)
75
+ */
76
+ source ?: ImageSourcePropType ;
77
+ /**
78
+ * @deprecated use 'source' prop
79
+ */
80
+ imageSource ?: ImageSourcePropType ;
81
+ /**
82
+ * Image props object
83
+ */
84
+ imageProps ?: ImageProps ;
85
+ /**
86
+ * Image style object used to pass additional style props
87
+ * by components which render image
88
+ */
89
+ imageStyle ?: ImageStyle ;
90
+ /**
91
+ * Listener-callback for when an image's (uri) loading
92
+ * starts (equiv. to Image.onLoadStart()).
93
+ */
94
+ onImageLoadStart ?: ImagePropsBase [ 'onLoadStart' ] ;
95
+ /**
96
+ * Listener-callback for when an image's (uri) loading
97
+ * either succeeds or fails (equiv. to Image.onLoadEnd()).
98
+ */
99
+ onImageLoadEnd ?: ImagePropsBase [ 'onLoadEnd' ] ;
100
+ /**
101
+ * Listener-callback for when an image's (uri) loading
102
+ * fails (equiv. to Image.onError()).
103
+ */
104
+ onImageLoadError ?: ImagePropsBase [ 'onError' ] ;
105
+ /**
106
+ * The name of the avatar user.
107
+ * If no label is provided, the initials will be generated from the name.
108
+ * autoColorsConfig will use the name to create the background color of the Avatar.
109
+ */
110
+ name ?: string ;
111
+ /**
112
+ * Hash the name (or label) to get a color, so each name will have a specific color.
113
+ * Default is false.
114
+ */
115
+ useAutoColors ?: boolean ;
116
+ /**
117
+ * Send this to use the name to infer a backgroundColor
118
+ */
119
+ autoColorsConfig ?: AutoColorsProps ;
120
+ /**
121
+ * Label that can represent initials
122
+ */
123
+ label ?: string ;
124
+ /**
125
+ * The label color
126
+ */
127
+ labelColor ?: string ;
128
+ /**
129
+ * ribbon label to display on the avatar
130
+ */
131
+ ribbonLabel ?: string ;
132
+ /**
133
+ * ribbon custom style
134
+ */
135
+ ribbonStyle ?: StyleProp < ViewStyle > ;
136
+ /**
137
+ * ribbon label custom style
138
+ */
139
+ ribbonLabelStyle ?: StyleProp < TextStyle > ;
140
+ /**
141
+ * Custom ribbon
142
+ */
143
+ customRibbon ?: JSX . Element ;
144
+ /**
145
+ * Custom size for the Avatar
146
+ */
147
+ size : number ;
148
+ /**
149
+ * Press handler
150
+ */
151
+ onPress ?: ( props : any ) => void ;
152
+ /**
153
+ * Used as a testing identifier
154
+ */
155
+ testID ?: string ;
156
+ } > ;
157
157
158
158
/**
159
159
* @description : Avatar component for displaying user profile images
@@ -266,7 +266,7 @@ class Avatar extends PureComponent<AvatarProps> {
266
266
< View style = { this . getRibbonStyle ( ) } > { customRibbon } </ View >
267
267
) : (
268
268
< View style = { [ this . getRibbonStyle ( ) , this . styles . ribbon , ribbonStyle ] } >
269
- < Text numberOfLines = { 1 } text100 $textDefaultLight style = { [ ribbonLabelStyle ] } >
269
+ < Text numberOfLines = { 1 } text100 $textDefaultLight style = { ribbonLabelStyle } >
270
270
{ ribbonLabel }
271
271
</ Text >
272
272
</ View >
0 commit comments