Skip to content

Conversation

@jakubkalinski0
Copy link
Contributor

@jakubkalinski0 jakubkalinski0 commented Sep 19, 2025

Explanation of Change

The whole issue comes from forwardRef being deprecated in the near future of react thus we will no longer be able to access the passed ref by element.ref as forwardRef is needed for passing ref as a separate attribute. Now in order to pass there reference it has to be passed as one of the props so we can access it directly or like that -> element.props.ref.

In order to adjust the codebase to new react recommendations in every file that was using forwardRef the ref had to be moved to the props instead of being a separate attribute and forwardRef had to be completely removed.

Some files had to be changed due to the changes made in other components. In response to the number of files that needed adjusting the changes are made in batches with this one being the seventh one.

This batch is pretty scattered all over the place just as the previous one due to there being no more clear flows that can provide us with meaningful number of files that require the change, thus all PR's going forward will probably be this scattered.

Modified files are grouped below by the components they are related to. In order to make testing easier there are also screenshots of places in app where you can find those components.

ActionSheetAwareScrollView

This one we test indirectly as it is used by other components

  1. src/components/ActionSheetAwareScrollView/index.ios.tsx
  2. src/components/ActionSheetAwareScrollView/index.tsx
  3. src/components/ActionSheetAwareScrollView/types.ts
Screenshot 2025-09-24 at 17 29 09
AddressSearch

This one has as different display name

image
  1. src/components/AddressSearch/index.tsx
  2. src/components/AddressSearch/types.ts
Screenshot 2025-09-23 at 17 35 24
AmountPicker
  1. src/components/AmountPicker/index.tsx
  2. src/components/AmountPicker/types.ts
Screenshot 2025-09-23 at 17 37 07
AmountWithoutCurrencyInput
  1. src/components/AmountWithoutCurrencyInput.tsx
Screenshot 2025-09-24 at 12 05 43
AttachmentCarousel/Pager

This one is only on native:

  1. src/components/Attachments/AttachmentCarousel/Pager/index.tsx
Screenshot 2025-09-24 at 16 53 33
CheckboxWithLabel
  1. src/components/CheckboxWithLabel.tsx
Screenshot 2025-09-24 at 17 16 10
ContextMenuItem
  1. src/components/ContextMenuItem.tsx
Screenshot 2025-09-24 at 12 07 36
CountrySelector
  1. src/components/CountrySelector.tsx
Screenshot 2025-09-23 at 17 44 26
CurrencySelector
  1. src/components/CurrencySelector.tsx
Screenshot 2025-09-25 at 12 25 49
DatePicker
  1. src/components/DatePicker/index.tsx
  2. src/components/DatePicker/types.ts
Screenshot 2025-09-23 at 17 26 37
FormScrollView
  1. src/components/FormScrollView.tsx
Screenshot 2025-09-25 at 13 07 56
HighlightableMenuItem
  1. src/components/HighlightableMenuItem.tsx
Screenshot 2025-09-23 at 17 25 38
InteractiveStep
  1. src/components/InteractiveStepSubHeader.tsx
Screenshot 2025-09-24 at 17 43 52
  1. src/components/InteractiveStepWrapper.tsx
Screenshot 2025-09-24 at 17 43 45
MagicCodeInput
  1. src/components/MagicCodeInput.tsx
Screenshot 2025-09-23 at 17 22 32
PercentageForm
  1. src/components/PercentageForm.tsx
Screenshot 2025-09-23 at 17 20 28
RadioButtons
  1. src/components/RadioButtons.tsx
Screenshot 2025-09-24 at 17 13 34
ShareTabParticipantsSelector

This one is only on native:

  1. src/components/Share/ShareTabParticipantsSelector.tsx
Screenshot 2025-09-24 at 17 34 53
SingleChoiceQuestion
  1. src/components/SingleChoiceQuestion.tsx
Screenshot 2025-09-24 at 17 13 17
StateSelector
  1. src/components/StateSelector.tsx
Screenshot 2025-09-23 at 14 47 59
TextLink
  1. src/components/TextLink.tsx
Screenshot 2025-09-23 at 14 43 23
TimeModalPicker
  1. src/components/TimeModalPicker.tsx
Screenshot 2025-09-23 at 13 43 01
withToggleVisibilityView

This one has a display name a little different than it's called, so don't get surprised

Screenshot 2025-09-23 at 13 31 11
  1. src/components/withToggleVisibilityView.tsx
Screenshot 2025-09-23 at 13 30 42 Screenshot 2025-09-23 at 13 30 42 (2)
withViewportOffsetTop
  1. src/components/withViewportOffsetTop.tsx
Screenshot 2025-09-23 at 13 21 47 Screenshot 2025-09-23 at 13 21 47 (2)

Fixed Issues

$ #67033
PROPOSAL: N/A

Tests

  1. Open Expensify without being logged in (now we will be testing MagicCodeInput and withToggleVisibilityView components)
  2. Input your email to the BaseLoginForm - with that we test withToggleVisibilityView which is used by the BaseLoginForm
  3. Verify that it works properly by pressing Continue
  4. Input the magic code
  5. Verify that MagicCodeInput works properly by pressing Sign in after inputing the code
  6. Now go to Account -> Profile
  7. Press Address in Private section (now we will be testing AddressSearch, CountrySelector and StateSelector components)
  8. Verify if AddressSearch works properly (i.e. you can look up any address)
  9. Change the country using CountrySelector
  10. Verify that changing the country works properly
  11. Now change the country to United States
  12. Change the state using StateSelector
  13. Verify that changing the state works properly
  14. Verify that adding the chosen address works properly, by pressing Save
  15. Now press Date of birth in Private section (now we will be testing DatePicker component)
  16. Choose any date from the calendar (you can play around with years and months)
  17. Verify if DatePicker works by checking if the picked date shows up in the Date input on top
  18. Verify if adding the chosen date works by pressing Save
  19. Now go to Subscription
  20. Press Add payment card (now we will be testing CurrencySelector component)
  21. Verify that the CurrencySelector works correctly by pressing it and changing the currency
  22. Now go to Security
  23. Press Merge accounts (now we will be testing CheckboxWithLabel)
  24. Verify that CheckboxWithLabel works correctly by pressing it (you can do it multiple times)
  25. Now go to Wallet
  26. Press Enable wallet (now we will be testing InteractiveStepSubHeader, InteractiveStepWrapper, RadioButtons and SingleChoiceQuestion components)
  27. Fill out the forms using this info -> https://swmansion.slack.com/archives/C01GTK53T8Q/p1711049879962529 (this data is required as it has to be real in order for the validation to let you through to the targeted forms)
  28. Verify that InteractiveStepWrapper works properly by filling out the bank info
  29. Verify that InteractiveStepSubHeader works properly by checking if the step header 'checks' the first step and moves on to focus the second one after filling out the bank info
  30. Now fill out the PersonalInfo section using information from the above slack discussion but it is for some reason crucial that you input the last name as Bobbeth otherwise you won't see IdologyQuestions which we need to test
  31. Verify that RadioButtons and SingleChoiceQuestion components work properly by answering the questions (you can do that correctly or not or both ways to test it - testing it with only one of those is fine and completely enough)
  32. Now go to Workspaces and choose any workspace that you are an owner of
  33. Press More -> Share (now we will be testing if ContextMenuItem component works properly)
  34. Verify that ContextMenuItem works properly by pressing the Copy URL and pasting it in the search bar of the web browser
  35. Verify that HighlightableMenuItem works properly by going to any feature of the workspace - if you can navigate between the features of the workspace (for example Overview to More features) then it works
  36. Go to More features and turn on Taxes, Rules and Per diem
  37. Press Taxes (now we will be testing AmountPicker component)
  38. Press +Add rate -> Value
  39. Verify that AmountPicker works properly by pressing it and adding the value
  40. Press Rules (now we will be testing PercentageForm component)
  41. Turn on Auto-approve compliant reports
  42. Verify that PercentageForm works properly by changing the value of Random report audit
  43. Press Per diem (now we will be testing TextLink component)
  44. Verify that TextLink works properly by pressing it and checking if the ExpensifyHelp site opens
  45. Download one of the Per Diem Rate Templates
  46. Import the downloaded spreadsheet
  47. Press the + floating button in the left bottom corner (now we will be testing TimeModalPicker component)
  48. Press Create expense -> Per diem and choose any per diem rate
  49. Verify that TimeModalPicker works properly by changing Start time or End time of the per diem expense
  50. Now go to Reports -> Filters
  51. Press Amount (now we will be testing AmountWithoutCurrencyInput component)
  52. Choose any one of Equal to, Greater than, Less than
  53. Verify that AmountWithoutCurrencyInput works properly by changing the value of one of the above and checking if it filtered the results properly
  54. Now go to any 1:1 chat (now we will be testing withViewportOffsetTop which is used to open some of the popovers properly -> in this case the EmojiPicker)
  55. Verify that withViewportOffsetTop works properly by pressing the EmojiPicker and choosing some emoji - check if it's properly added to the message composer

This one needs to be done on staging
56. Go to URL https://staging.new.expensify.com/
57. Login with any account
58. Verify that FormScrollView works properly by opening the enable payments page http://staging.new.expensify.com/enable-payments - if it loads correctly and you are able to go further with the flow then it works

This one need to be done on native
59. Go to the Photos/Gallery on the phone and share some image with Expensify
60. Verify that ShareTabParticipantsSelector works properly by sharing the image with other user/workspace
61. Now go to any 1:1 chat and add a few images in the chat
62. Press on the image so that the AttachmentCarousel opens up
63. Verify that the Pager works correctly by traversing through the attachments
64. Go to any 1:1 chat and add a few messages
65. Verify that ActionSheetAwareScrollView works properly by editing one of the messages

  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

Same as Tests

  • Verify that no errors appear in the JS console

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 the expected offline behavior in the Offline steps 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • 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 is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • 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.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • 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.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native

Steps from 59 to 65:

59to65.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari

Steps from 1 to 18:

1to18.mp4

Steps from 19 to 24:

19to24.mp4

Steps from 25 to 31:

25to31.mp4

Steps from 32 to 49:

32to49.mp4

Steps from 50 to 55:

50to55.mp4

This one has to be done on staging
Steps from 56 to 58:

56to58.mp4
MacOS: Desktop

@jakubkalinski0 jakubkalinski0 force-pushed the jakubkalinski0/Fix-console-errors-related-to-forwardRef-batch7 branch from 3d2f637 to b6e8284 Compare September 22, 2025 07:36
@jakubkalinski0 jakubkalinski0 force-pushed the jakubkalinski0/Fix-console-errors-related-to-forwardRef-batch7 branch from ddbb7cd to 20fb6e6 Compare September 22, 2025 08:52
@jakubkalinski0 jakubkalinski0 marked this pull request as ready for review September 29, 2025 14:34
@jakubkalinski0 jakubkalinski0 requested a review from a team as a code owner September 29, 2025 14:34
@melvin-bot melvin-bot bot requested review from c3024 and removed request for a team September 29, 2025 14:34
@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2025

@c3024 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@mountiny
Copy link
Contributor

@c3024 what is your ETA for the review?

@c3024
Copy link
Contributor

c3024 commented Sep 30, 2025

Reviewer 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 that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • 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 there are no new alerts related to the canBeMissing param for useOnyx
  • 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 is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • 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.ts 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • 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.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
ref7Android.mov
Android: mWeb Chrome
ref7AndroidmWeb.mov
ref7AndroidmWeb1.mov
iOS: HybridApp
ref7iOS1.mov
ref7iOS2
iOS: mWeb Safari
ref7iOSmWeb.mov
ref7iOSmWeb1
MacOS: Chrome / Safari
ref7Chrome1.mp4
ref7Chrome2.mov
ref7Chrome3.mp4
ref7Chrome4.mp4
ref7Chrome5.mp4
MacOS: Desktop
ref7Desktop.mov

@c3024
Copy link
Contributor

c3024 commented Sep 30, 2025

Does not seem related to this migration but we can remove this redundant forwardRef here.

export default forwardRef(SingleFieldStep);

Screenshot 2025-09-30 at 9 15 17 AM

Copy link
Contributor

@c3024 c3024 left a comment

Choose a reason for hiding this comment

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

LGTM!

@melvin-bot melvin-bot bot requested a review from mountiny September 30, 2025 07:35
@jakubkalinski0
Copy link
Contributor Author

@c3024 Yeah, this component will be taken care of in the next batch. I hope I can fit all the remaining components (about 20-ish) into batch 8 and finish the migration.

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Code changes look good to me

@mountiny mountiny merged commit 7ff4e0f into Expensify:main Sep 30, 2025
21 of 33 checks passed
@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 https://github.com/mountiny in version: 9.2.21-0 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Oct 2, 2025

🚀 Deployed to production by https://github.com/Julesssss in version: 9.2.21-4 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Oct 2, 2025

🚀 Deployed to production by https://github.com/Julesssss in version: 9.2.21-4 🚀

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants