-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Migrate AvatarWithImagePicker.js to function component #23160
Conversation
Hey @mollfpr! Could you have a look at this PR, because it's been a while, since it has been created 😄 |
@staszekscp Sorry, I thought we were waiting for the issue off hold 😅 I'll do the review in the morning, thank you! |
Sorry for the delay; the code looks good. Just need to resolve the conflicts, and I'll do the final test. Thanks! |
@mollfpr I took over this PR, resolved the conflicts and made one small improvement as I saw some errors in the console. Please have a look now 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @blazejkustra for the update 👍
I'll finish the test in the morning.
/** Flag to see if image is being uploaded */ | ||
isUploading: PropTypes.bool, | ||
/** Where the popover should be positioned relative to the anchor points. */ | ||
anchorAlignment: PropTypes.shape({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: no default props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted 👍 Thanks for quick response!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I misunderstood your comment. Adjusted it one more time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blazejkustra The app crashes on clicking the workspace avatar. Might it be related to useLocalize
?
Screen.Recording.2023-08-09.at.20.52.32.mov
maskImage={editorMaskImage} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
AvatarWithImagePicker.propTypes = propTypes; | ||
AvatarWithImagePicker.defaultProps = defaultProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must add the displayName
property for the function component.
I investigated it deeply, even reduced import React, {useState} from 'react';
function AvatarWithImagePicker() {
const [validationError, setValidationError] = useState(null);
return null;
}
AvatarWithImagePicker.displayName = 'AvatarWithImagePicker';
export default AvatarWithImagePicker; But the hook error was still appearing in the console. Which is very weird as there is nothing wrong with hooks in the snippet above. So I dig deeper, only once I removed |
Found the real cause and reported it on |
This PR is now on HOLD until #25397 is fixed. |
Details
this.animation.start()
),this.animation.getSyncingStyles()
is not actually used anywhere and the styles are not passed toAnimated.View
. It looks like they should be passed to some sort of spinning loader component and were in the past, but the component was removed at some point. I removed the animation-related code, but I'm not sure if the fact that this animated loader is missing is a bug or a feature.Fixed Issues
$ #16119
Tests
Offline tests
Upload a photo offline, then go online. Check if the photo updated.
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.mov
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
electron.mov
iOS
ios.mov
Android
android.mov