Skip to content

Commit

Permalink
Merge pull request #26148 from dukenv0307/fix/25405
Browse files Browse the repository at this point in the history
Clear the image error when going back from other menus
  • Loading branch information
neil-marcellini authored Sep 18, 2023
2 parents 6be8fca + 98a3bf5 commit 4c535d6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/AvatarWithImagePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import getImageResolution from '../libs/fileDownload/getImageResolution';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
import DotIndicatorMessage from './DotIndicatorMessage';
import * as Browser from '../libs/Browser';
import withNavigationFocus, {withNavigationFocusPropTypes} from './withNavigationFocus';
import compose from '../libs/compose';

const propTypes = {
/** Avatar source to display */
Expand Down Expand Up @@ -80,6 +82,7 @@ const propTypes = {
errors: PropTypes.object,

...withLocalizePropTypes,
...withNavigationFocusPropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -129,6 +132,9 @@ class AvatarWithImagePicker extends React.Component {
}

componentDidUpdate(prevProps) {
if (!prevProps.isFocused && this.props.isFocused) {
this.setError(null, {});
}
if (!prevProps.isUploading && this.props.isUploading) {
this.animation.start();
} else if (prevProps.isUploading && !this.props.isUploading) {
Expand Down Expand Up @@ -350,4 +356,4 @@ class AvatarWithImagePicker extends React.Component {
AvatarWithImagePicker.propTypes = propTypes;
AvatarWithImagePicker.defaultProps = defaultProps;

export default withLocalize(AvatarWithImagePicker);
export default compose(withLocalize, withNavigationFocus)(AvatarWithImagePicker);

0 comments on commit 4c535d6

Please sign in to comment.