@momo-kits/avatar 0.0.65-beta → 0.0.73-beta
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/Avatar.js +7 -3
- package/package.json +1 -1
package/Avatar.js
CHANGED
|
@@ -297,6 +297,7 @@ export default class Avatar extends Component {
|
|
|
297
297
|
source: props.source,
|
|
298
298
|
dimensions: {}
|
|
299
299
|
};
|
|
300
|
+
this.imageSource = '';
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
componentDidMount() {
|
|
@@ -436,8 +437,11 @@ export default class Avatar extends Component {
|
|
|
436
437
|
};
|
|
437
438
|
}
|
|
438
439
|
|
|
439
|
-
onLoadSourceError = () => {
|
|
440
|
-
this.
|
|
440
|
+
onLoadSourceError = (imageSource) => {
|
|
441
|
+
if(this.imageSource?.uri !== imageSource?.uri){
|
|
442
|
+
this.imageSource = imageSource;
|
|
443
|
+
this.setState({ hideSource: true, ownUpdate: true });
|
|
444
|
+
}
|
|
441
445
|
}
|
|
442
446
|
|
|
443
447
|
renderSubIcon = () => {
|
|
@@ -503,7 +507,7 @@ export default class Avatar extends Component {
|
|
|
503
507
|
cached={cached}
|
|
504
508
|
loading={loading || isShowLoading}
|
|
505
509
|
source={imageSource}
|
|
506
|
-
onError={this.onLoadSourceError}
|
|
510
|
+
onError={() => this.onLoadSourceError(imageSource)}
|
|
507
511
|
style={avatarStyle}
|
|
508
512
|
resizeMode={resizeMode}
|
|
509
513
|
{...extraPropsImage}
|