Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.03k stars 2.54k forks source link

Update App to React Native 0.72 version #18507

Closed fabioh8010 closed 10 months ago

fabioh8010 commented 1 year ago

Details

This PR aims to update Expensify's App to use our RN 0.72 fork. Some changes were made in order to follow upgrading from previous RN version to current one, following this steps.

SLACK DISCUSSION THREAD: https://expensify.slack.com/archives/C01GTK53T8Q/p1683321604215369

Patches created and corresponding upstream PRs

Fixed Issues

$ https://github.com/Expensify/App/issues/18444 $ https://github.com/Expensify/App/issues/21308 PROPOSAL: -

Tests

Full regression test

Offline tests

Same as above.

QA Steps

Same as above.

PR Author Checklist

Screenshots/Videos

Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android
fabioh8010 commented 11 months ago

@roryabraham Your steps solved the problem. Strangely, node_modules was not present in that folder and I had to install it manually like you said. Is it something that we have to do manually or should it install together when running npm install on the root folder? I'm asking this because I don't remember having to do it before.

fabioh8010 commented 11 months ago

Update

@mountiny @roryabraham I think we are good to go with this PR now (we have one pending discussion here though). Please review the PR and let me know if you need more testing from my side, or a specific one.

roryabraham commented 11 months ago

Is it something that we have to do manually or should it install together when running npm install on the root folder? I'm asking this because I don't remember having to do it before.

It should happen in a postInstall script

roryabraham commented 11 months ago

@fabioh8010 there's an unrelated test failure that was present on main. Can you merge main again to resolve that please?

parasharrajat commented 11 months ago

Awesome timing @fabioh8010. Going to run a full App scan...

parasharrajat commented 11 months ago

The web is looking pretty unchanged(Good).

parasharrajat commented 11 months ago

Android Looks good.

parasharrajat commented 11 months ago

Every time, I close the keyboard On iOS, I see a warning.

Screenshot 2023-07-02 at 1 47 53 PM
fabioh8010 commented 11 months ago

Hi @parasharrajat Yes, I saw this warning as well and I was able to reproduce it on main on Friday. I will test it again.

parasharrajat commented 11 months ago

Question: Do you see opening or closing animation for the FAB menu on iOS and Android?

ntdiary commented 11 months ago

Every time, I close the keyboard On iOS, I see a warning.

https://github.com/Expensify/App/blob/b7004b9e9ff2bb86d6357e62ce15659322032c65/patches/react-native%2B0.71.2-alpha.3.patch#L67

@parasharrajat, this issue is that enabled is not defined, I guess we wanted to use this.props.enabled here?

For this PR, it's react-native+0.72.1.patch

fabioh8010 commented 11 months ago

Makes sense @ntdiary, thanks for investigation! This is probably happening on main as well because this patch is also there, @parasharrajat could you please confirm this?

parasharrajat commented 11 months ago

Yes, it is present on the main as well. So let's not fix it here. Reported https://expensify.slack.com/archives/C049HHMV9SM/p1688406249179949.

fabioh8010 commented 11 months ago

Question: Do you see opening or closing animation for the FAB menu on iOS and Android?

Testing..

fabioh8010 commented 11 months ago

@parasharrajat I tested the FAB button on both main and this branch and there is no difference in my machine.

"main" branch - Android https://github.com/Expensify/App/assets/20051562/9df56ac7-e923-4fa3-95fd-183852fec3dc
"main" branch - iOS https://github.com/Expensify/App/assets/20051562/a86cfdfa-fb85-4d2c-9c8b-ac44314e55e6
this branch - Android https://github.com/Expensify/App/assets/20051562/d8b3cf5e-969b-4765-81d4-b51b9f2912c9
this branch - iOS https://github.com/Expensify/App/assets/20051562/7543a0cc-be5a-44e6-8ad1-05fbdfc47a99

Besides that, I've updated this branch against main again, please feel free to continue testing.

parasharrajat commented 11 months ago

Thanks. It might be just due to heavy dev builds. I am trying to find bugs because it is hard to believe that it worked without a hitch.

fabioh8010 commented 11 months ago

@parasharrajat Please let me know if you need more help from my side.

parasharrajat commented 11 months ago

Yeah, sure. I will finish my testing today.

aimane-chnaif commented 11 months ago

We should also check all other features and bug fixes done from our forked RN, which not existed in upstream RN. As this PR will revert those which are not applied to upstream RN.

parasharrajat commented 11 months ago

Good call @aimane-chnaif

mountiny commented 11 months ago

Good call, I thought we have already managed to get all our fork changes to the upstream @chrispader would you be able to have a look at this?

If this would require a patch while we will wait for the fix to hit upstream, I think that would be better than holding this update.

fabioh8010 commented 11 months ago

Good call, I thought we have already managed to get all our fork changes to the upstream @chrispader would you be able to have a look at this?

@mountiny @aimane-chnaif I recalled about a spreadsheet with the status of each PR merged in Expensify's fork that was shared in the channel -> https://docs.google.com/spreadsheets/d/1Fvc2x0ythHoqE1NnsP5JTOLC0eXbWV5IrA-37hbJDGc/edit#gid=1594942597

Tomorrow I can take a look in each PR and see if's actually available on the last release.

If this would require a patch while we will wait for the fix to hit upstream, I think that would be better than holding this update.

It's worth mentioning that it won't be possible to use patches to fix native issues in Android, as the Android sources are now shipped in pre-built artifacts. cc @chrispader

fabioh8010 commented 11 months ago

Looking through the spreadsheet and changelog:

šŸŸ¢ Merged and available on Upstream RN. šŸŸ” Merged but not available on latest RN release yet. šŸŸ  Not sure about status on Upstream RN. šŸ”“ No Upstream PR or not merged on Upstream RN yet. šŸŸ£ Patched on this PR. āŒ Possible blocker. šŸ”Ø Can be patched if necessary.

cc @mountiny

parasharrajat commented 11 months ago

Hmm, There are a lot with undefined status. I didn't know there was a sheet. Thanks.

fabioh8010 commented 11 months ago

Thanks @parasharrajat , updated the list.

hannojg commented 11 months ago

https://github.com/Expensify/react-native/pull/33: Merged on our Fork. It seems that there is no Upstream PR. Could you confirm @hannojg?

This PR is for a fix on android to circumvent a ANR, we are working to get these changes into react native core. The tracking PRs can be found here:

Until they are merged I recommend making the verticalScrollbarPosition part of a patch for react native (its a relatively small and none invasive change I'd say)

janicduplessis commented 11 months ago

@fabioh8010 All fixes related to maintainVisibleContentPosition have been upstreamed and released in 0.72 except for https://github.com/Expensify/react-native/pull/16.

I will work on getting https://github.com/Expensify/react-native/pull/16 upstreamed but I don't think this is a blocker as we don't use this functionality currently.

mountiny commented 11 months ago

Ah I swear I remember someone mentioning that most of our stuff should be merged and release already so probably they did not have this spreadsheet. Thanks!

Which one of these do we need to block on if any. Can we use the patch for what @hannojg mentioned?

fabioh8010 commented 11 months ago

@fabioh8010 All fixes related to maintainVisibleContentPosition have been upstreamed and released in 0.72 except for https://github.com/Expensify/react-native/pull/16.

I will work on getting https://github.com/Expensify/react-native/pull/16 upstreamed but I don't think this is a blocker as we don't use this functionality currently.

Thanks for the info @janicduplessis! Regarding to https://github.com/Expensify/react-native/pull/46, could you please confirm if this commit got merged on Upstream or is part of some fix? I was unable to find it in the source code and changelog.


Ah I swear I remember someone mentioning that most of our stuff should be merged and release already so probably they did not have this spreadsheet. Thanks!

@mountiny I got the spreadsheet from this message on Slack, I think we just didn't have enough visibility of the status of the PRs without doing a deeper investigation.


Which one of these do we need to block on if any. Can we use the patch for what @hannojg mentioned?

@hannojg From what I understood we would have to patch Android source files to apply the fix, right? If it's the case, it's not possible because the android sources are shipped pre-built during build process, so making a patch won't make difference.

@mountiny I updated the list with āŒ (possible blocker) and šŸ”Ø (can be patched) labels. Currently, it seems to me that we have two possible blockers, https://github.com/Expensify/react-native/pull/37 and https://github.com/Expensify/react-native/pull/33. @aimane-chnaif @parasharrajat could you confirm if I'm missing something?

fabioh8010 commented 11 months ago

As we're using RN directly, android bugs from our previously forked RN are gone:

https://github.com/Expensify/App/issues/17368 (fixed already but was workaround, all numberOfLines={100} occurrences can be safely removed) [HOLD][$1000] Web- Preferences - The recent mode description is truncated in Spanish preference #17509 (to fix, revert alternateTextMaxLines back to 0 from undefined) https://github.com/Expensify/App/issues/17441 (fixed)

@aimane-chnaif Just to clarify, I have to apply those 2 changes you suggested in this branch, right? all numberOfLines={100} occurrences can be safely removed and to fix, revert alternateTextMaxLines back to 0 from undefined.

aimane-chnaif commented 11 months ago

As we're using RN directly, android bugs from our previously forked RN are gone:

17368 (fixed already but was workaround, all numberOfLines={100} occurrences can be safely removed)

[HOLD][$1000] Web- Preferences - The recent mode description is truncated in Spanish preference #17509 (to fix, revert alternateTextMaxLines back to 0 from undefined)

17441 (fixed)

@aimane-chnaif Just to clarify, I have to apply those 2 changes you suggested in this branch, right? all numberOfLines={100} occurrences can be safely removed and to fix, revert alternateTextMaxLines back to 0 from undefined.

yes, it would be good but not a blocker.

hannojg commented 11 months ago

@fabioh8010 Yes, these are native changes, however its a change on the java files, not on the CPP files. The pre-shipped binaries are only for the native cpp libs afaik.

So that shouldn't be an issue šŸ˜Š

fabioh8010 commented 11 months ago

Hmm I think it also applies to Java files šŸ¤” , will test @hannojg and let you know, thanks.

chrispader commented 11 months ago

It's worth mentioning that it won't be possible to use patches to fix native issues in Android, as the Android sources are now shipped in pre-built artifacts. cc @chrispader

Yes, @fabioh8010 is right, we won't be able to include the maxNumberOfLines and numberOfLines feature @Szymon20000 implemented in the fork with just a patch. cc @mountiny

I'll check with @Szymon20000 how the progress in the upstream PR is going...

fabioh8010 commented 11 months ago

Yes @chrispader @hannojg the prebuilts also include Java files, so any fixes to native Android side can't be patched.

It would be good if it was possible to come up with workarounds on JS side for now, until the pending PRs are merged and available in a future RN release, to avoid blocking this one.

fabioh8010 commented 11 months ago

@aimane-chnaif I removed the occurrences of numberOfLines={100} and it's working as expected, but I wasn't able to reproduce the bug related to https://github.com/Expensify/App/issues/17509, could you please check?

aimane-chnaif commented 11 months ago

I removed the occurrences of numberOfLines={100} and it's working as expected

šŸ‘

I wasn't able to reproduce the bug related to https://github.com/Expensify/App/issues/17509, could you please check?

@fabioh8010 you mean on main or this branch?

fabioh8010 commented 11 months ago

@aimane-chnaif this branch.

aimane-chnaif commented 11 months ago

@aimane-chnaif this branch.

Can you also test on main? https://github.com/Expensify/App/issues/17509 is web issue and this PR just upgraded RN version so web shouldn't be affected.

janicduplessis commented 11 months ago

Regarding to https://github.com/Expensify/react-native/pull/46, could you please confirm if this commit got merged on Upstream or is part of some fix? I was unable to find it in the source code and changelog.

@fabioh8010 It was merged as part of https://github.com/facebook/react-native/pull/35993

fabioh8010 commented 11 months ago

@aimane-chnaif It turns out that PriorityModePage is using another component now, SelectionListRadio. This component list items don't use this alternateTextMaxLines prop, so we can safely remove alternateTextMaxLines from PriorityModePage.

aimane-chnaif commented 11 months ago

@fabioh8010 yes, I see that PR was merged yesterday and PriorityModePage is no longer using OptionRow. Safe to remove

hannojg commented 11 months ago

@fabioh8010 Kindly disagreeing here, the react-native core files are shipped as source with the npm react-native package (and it will stay this way).

You can verify yourself by checking e.g. node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/

AndrewGable commented 11 months ago

FYI - Excited for this one so I kicked off another AdHoc build

janicduplessis commented 11 months ago

šŸ”“ / šŸ”Ø https://github.com/Expensify/react-native/pull/16: Merged on our Fork. There is no Upstream PR yet, @janicduplessis will open one but it seems that is a functionality that is not used yet in the project.

Upstream PR opened https://github.com/facebook/react-native/pull/38245

fabioh8010 commented 11 months ago

@fabioh8010 Kindly disagreeing here, the react-native core files are shipped as source with the npm react-native package (and it will stay this way).

You can verify yourself by checking e.g. node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/

@hannojg Yes, there are indeed Java files in that folder but modifying them won't make any difference when building the app (I just tested here as well), as stated in this guide we will be consuming precompiled artifacts when building for Android.

However, I also discovered that we can configure the project to build from source and by doing that it will be possible to apply changes to those files. I was able to apply your fix by configuring the project to build from source (the scroll indicator is on the correct side now):

https://github.com/Expensify/App/assets/20051562/b62cec7b-ba0c-43dc-b59b-1aad2db1a3a0

@roryabraham @mountiny WDYT about this? In this way we can patch the two fixes https://github.com/Expensify/react-native/pull/37 and https://github.com/Expensify/react-native/pull/33. The first disadvantage that I see is that the patch file will be gigantic, but it would allows us to move forward with this PR.

roryabraham commented 11 months ago

@fabioh8010 building from source sure is a bummer because of increased build times, but it's an acceptable cost since we seem to be using those upstream features.

The first disadvantage that I see is that the patch file will be gigantic

We're working w/ the maintainer of patch-package to alleviate this problem by allowing multiple patches. You can follow that progress here:

roryabraham commented 11 months ago

Actually, I just remembered that there is a canary release available for multiple patches published from this PR branch: https://github.com/ds300/patch-package/pull/474

So I'd suggest we start using it right away rather than creating a monolithic patch. Any feedback would be very helpful.

You can do npm install patch-package@canary to try out the --append flag. I think the workflow will be like so:

  1. Make the changes from https://github.com/facebook/react-native/pull/35703, then run npx patch-package --append 'NumberOfLines'
  2. Make the changes from https://github.com/facebook/react-native/pull/38073, then run npx patch-package --append 'VerticalScrollBarPosition'
roryabraham commented 11 months ago

Actually, just re-reviewing these PRs more carefully:

So it looks like neither of these are true blockers and we don't need to use the patches after all. Sorry, I just got excited about our new tool there... but I'm even more excited about not having to build Android from source.

fabioh8010 commented 10 months ago

@roryabraham Just to clarify better the issues:

https://github.com/Expensify/App/assets/20051562/d431b075-f5b6-47c5-bc4b-5cac9d4bfca3

https://github.com/Expensify/App/assets/20051562/32f24266-2758-4b08-901e-fe27c362fa42

If we are OK with having this issues while they are not available in Upstream RN yet, we can safely merge this PR šŸ‘