Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear the image error when going back from other menus #26148

Merged
merged 7 commits into from
Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Loading