-
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
Remove class component from ReportActionsList
#16613
Conversation
// This is a workaround to a reanimated issue -> https://github.com/software-mansion/react-native-reanimated/issues/3355 | ||
if (process.browser) { | ||
// eslint-disable-next-line no-underscore-dangle | ||
window._frameTimestamp = null; | ||
} |
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.
It looks like software-mansion/react-native-reanimated#3355 was fixed in software-mansion/react-native-reanimated@2fd0da8 which was released in 3.0.0, however you're still using 3.0.0-rc.10. It's okay to keep this workaround as for now but once you upgrade to 3.0.0+ (currently the latest version is 3.0.2) you should be safe to get rid of it.
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.
Hey there :-)
Using reanimated@3.0.2 I still seem to have this problem with next.js unfortunately.
next.js version is 12.1.5
The workaround from above still seems to work.
ReportActionsList
Had some time to test this one so taking it out of draft. |
// Workaround to a reanimated issue -> https://github.com/software-mansion/react-native-reanimated/issues/3355 | ||
// We can remove it as soon as we are on > reanimated 3.0.0+ | ||
if (process.browser) { | ||
// eslint-disable-next-line no-underscore-dangle | ||
window._frameTimestamp = null; | ||
} | ||
|
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.
Shouldn't this workaround be used in a Top Level since we may need it for other components too.
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.
Good point. I think it can.
function keyExtractor(item) { | ||
return item.reportActionID; | ||
} |
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.
Why this function is defined outside ReportActionsList
Wouldn't it be better to define it inside and useCallback
with empty dependency array.
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 had some conversation here about it: https://expensify.slack.com/archives/C01GTK53T8Q/p1680096510744619
I don't have a strong preference though and just going with what we decided there. Can you think of some different or better arguments on why to do what you suggest?
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.
Just thought that since keyExtractor
was a part of the class component it should still be a part of the functional component but maybe having that function a part of the class component was a "mistake" in the first place.
I think having the function defined outside is slightly better e.g. If we render 100 instances of that component all will use the same function, where if we defined it inside each will use it's own function (100 functions that are all the same).
Reviewer Checklist
Screenshots/Videos |
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.
LGTM! 🚀
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.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/marcaaron in version: 1.3.0-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.0-2 🚀
|
Details
Refactors the
ReportActionsList
to use React Hooks.Fixed Issues
$ #16266
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android