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

perf: reanimated 3 upgrade #11567

Merged
merged 19 commits into from
Oct 25, 2022
Merged

Conversation

hannojg
Copy link
Contributor

@hannojg hannojg commented Oct 4, 2022

Details

This PR upgrades reanimated to version 3. It's based on #11550 by @marcaaron since his PR removes any reanimated v1 usage (which rea v3 dropped support for). [This PR has since landed on main, so that's good!]

This PR is an effort toward enabling fabric architecture.

Fixed Issues

Related #8503

Tests

  1. Crop and edit your avatar
  2. Use the left hand nav bar to navigate to reports

PR Review Checklist

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

PR Reviewer Checklist

The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • Any functional components have the displayName property
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

QA Steps

  1. Crop and edit your avatar
  2. Use the left hand nav bar to navigate to reports

Screenshots

Web

Screen Shot 2022-10-20 at 1 29 25 PM

Screen Shot 2022-10-20 at 1 29 45 PM

Mobile Web - Chrome

Screen Shot 2022-10-20 at 1 30 14 PM

Screen Shot 2022-10-20 at 1 30 34 PM

Mobile Web - Safari

Screen Shot 2022-10-20 at 1 35 26 PM

Screen Shot 2022-10-20 at 1 35 11 PM

Desktop

Screen Shot 2022-10-20 at 1 32 34 PM

Screen Shot 2022-10-20 at 1 32 55 PM

iOS

Screen Shot 2022-10-20 at 1 15 28 PM

Screen Shot 2022-10-20 at 1 15 49 PM

Android

Screen Shot 2022-10-20 at 1 20 21 PM

Screen Shot 2022-10-20 at 1 20 59 PM

@hannojg hannojg force-pushed the perf/rea-3-upgrade branch 2 times, most recently from b32cb9c to 8a38df0 Compare October 4, 2022 13:43
@hannojg
Copy link
Contributor Author

hannojg commented Oct 4, 2022

Update:

After talking to the team at react-navigation it appears that we have to use force install, or wait until reanimated v3 is officially released:
react-navigation/react-navigation#10909 (comment)

… or we switch to using yarn, which is faster anyways

@JmillsExpensify JmillsExpensify changed the title perf: reanimated 3 upgrade [HOLD] perf: reanimated 3 upgrade Oct 10, 2022
@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2022

Hey, I noticed you changed some webpack configuration files. This can break production builds. Did you remember to run a production build locally to verify they still work?

@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2022

Looks like you modified DeprecatedCustomActions.js! To be clear, you should not be adding any code to this file.

This file contains deprecated workarounds for limitations of react-navigation and a more long term solution will need to be investigated.

Drop a note in #expensify-open-source to discuss with the team how to proceed.

@hannojg
Copy link
Contributor Author

hannojg commented Oct 17, 2022

I just added a fix with patch-package for the installation issue, which we can use until REA v3 is officially released.
Are we cool with that?

@hannojg hannojg force-pushed the perf/rea-3-upgrade branch from 25cf51c to f87600e Compare October 17, 2022 11:51
@JmillsExpensify JmillsExpensify changed the title [HOLD] perf: reanimated 3 upgrade perf: reanimated 3 upgrade Oct 18, 2022
@roryabraham
Copy link
Contributor

Yes, using patch-package is fine 👍🏼 Let's get this PR polished up and over the finish line

@hannojg hannojg marked this pull request as ready for review October 19, 2022 07:48
@hannojg hannojg requested a review from a team as a code owner October 19, 2022 07:48
@melvin-bot melvin-bot bot requested review from Beamanator and Santhosh-Sellavel and removed request for a team October 19, 2022 07:48
@AndrewGable AndrewGable self-requested a review October 19, 2022 14:44
@Santhosh-Sellavel
Copy link
Collaborator

@hannojg Are there any test steps here, Does something need to compare?

cc: @Beamanator

This reverts commit d8a07bf.
@hannojg
Copy link
Contributor Author

hannojg commented Oct 20, 2022

@Santhosh-Sellavel this is just some internal library update. Reanimated isn't used too much around the code base. Most noticeably it's used for the drawer (reports list/ SideBarLinks and the actual Report View). So any interaction with the drawer maybe should be paid attention to.

However, really opening the app and it not crashing should be test-steps enough for this change 😄

@JmillsExpensify
Copy link

Are you all coming back to this PR today? Looks like we're at the finish line, just need to resolve the console errors. Right?

@hannojg
Copy link
Contributor Author

hannojg commented Oct 25, 2022

Yes, gonna look into it again today so we can merge it today!

@hannojg
Copy link
Contributor Author

hannojg commented Oct 25, 2022

Adding to my testing notes:

Warnings are reproducible when navigating from list to report, so its very likely coming from the drawer's REA usage

@hannojg
Copy link
Contributor Author

hannojg commented Oct 25, 2022

Okay everyone, we can safely ignore this warning. For two reasons:

  1. It's just a developer warning that react native generated for us to let us know we can reduce sending events to the JS side, as no listeners for native events are set up yet. In REA 3 they forget a check for that, I will make a PR to get rid of that warning (however this doesn't have to block us from merging IMO (but not sure how you guys treat new warnings in the console))

  2. Most importantly: once we turn on the new arch, the code in REA that sends these events will be handled differently anyways, so we are not getting hit by those events:

Screenshot 2022-10-25 at 10 23 29


I will look into the web warnings shortly, but just quickly looking at it it just seems like a general warning that we can't really do anything about. We are not using the legacy code, however, the warnings are still generated just by the pure presence of the legacy code. I think this can/will only be resolved when the legacy implementation gets removed from the drawer lib. But maybe we can at least suppress these warnings if we want to.

@hannojg
Copy link
Contributor Author

hannojg commented Oct 25, 2022

REA issue and accompanying PR is up: software-mansion/react-native-reanimated#3716

@hannojg
Copy link
Contributor Author

hannojg commented Oct 25, 2022

We can also ignore the web warnings. If you want to I can add a commit to suppress the warnings. Can only go away once the legacy code gets removed :)

So as a summary I think we are good to merge

@roryabraham
Copy link
Contributor

Created this issue to follow-up and remove the patch

@roryabraham
Copy link
Contributor

Sorry @hannojg, I think you need to reinstall pods and commit the diff

software-mansion/react-native-reanimated#3701

Only applied parts, because on REA's main branch the ios project setup changed a bit so i needed to only use whats necessary for the current setup.\

This part of the patch can be reverted once the PR landed and we updated the REA version
@Santhosh-Sellavel
Copy link
Collaborator

I am seeing changes committed frequently. @hannojg is this ready for review?

@AndrewGable
Copy link
Contributor

Yes it is, it has some priority so if you could review ASAP @Santhosh-Sellavel that would be great!

Copy link
Contributor

@AndrewGable AndrewGable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots

Screen Shot 2022-10-25 at 11 28 40 AM

Screen Shot 2022-10-25 at 11 31 39 AM

Screen Shot 2022-10-25 at 11 34 33 AM

Screen Shot 2022-10-25 at 11 36 09 AM

Screen Shot 2022-10-25 at 11 25 01 AM


@Santhosh-Sellavel - Let me know when you've approved and I can merge 🚀

@Santhosh-Sellavel
Copy link
Collaborator

@AndrewGable We are Ignoring the console errors, right?

@AndrewGable
Copy link
Contributor

From reading #11567 (comment) - Yes, I believe we are OK to ignore warnings.

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Oct 25, 2022

Screen Recording

Desktop

Screen.Recording.2022-10-25.at.11.27.37.PM.mov

Web

Screen.Recording.2022-10-25.at.11.32.06.PM.mov

iOS (Build using Xcode)

Simulator.Screen.Recording.-.iPhone.13.-.2022-10-25.at.23.20.01.mp4

Android

Screen.Recording.2022-10-25.at.11.20.31.PM.mov

mWeb

Simulator.Screen.Recording.-.iPhone.13.-.2022-10-25.at.23.35.38.mp4

PR Reviewer Checklist

C+ Reviewed
🎀 👀 🎀

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

@Santhosh-Sellavel
Copy link
Collaborator

@AndrewGable I am having trouble while running yarn ios, build always fails does that work for you? I've used Xcode app to build the app.

@AndrewGable
Copy link
Contributor

I am able to successfully build via npm run ios

@Santhosh-Sellavel
Copy link
Collaborator

Thanks then we are good to merge!

Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Santhosh-Sellavel
Copy link
Collaborator

iOS build working now after npm run clean

iOS

Simulator.Screen.Recording.-.iPhone.13.-.2022-10-26.at.01.46.39.mp4

@AndrewGable AndrewGable merged commit 0973e75 into Expensify:main Oct 25, 2022
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @AndrewGable in version: 1.2.20-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.2.20-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

7 participants