Closed mvtglobally closed 5 months ago
Triggered auto assignment to @stitesExpensify (Engineering
), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
This can definitely be external. I went ahead and flagged it as a potential issue for the Margelo team to work on: https://expensify.slack.com/archives/C035J5C9FAP/p1649217447621559
Awesome, Margelo would love to work on this! We noticed that you use a lot of third party React Native libraries, so it'll be a bit difficult to get those migrated as well. Especially problematic is Reanimated, but the SWM team is working on bringing that to Fabric.
Let's coordinate internally which issue we want to prioritize :)
Making this a weekly while we prioritize
Moving to monthly
@mrousavy just for clarity on this issue, where is it currently prioritized?
I believe currently we are not working on this issue, maybe let's discuss this in the Slack channel? We are currently working a lot with Coinbase and have very limited availability, but we expect to have some in two weeks!
I've stumbled on this ticket thanks to experimenting with Fabric and the new RN Architecture. It turns out migrating would resolve one top paying issue here: https://github.com/Expensify/App/issues/8349#issuecomment-1151172897
I think we can
I'm posting a comment to keep in touch I'll be happy to work or take part in landing the new architecture in App
Thanks for volunteering @kidroca! There is still a lot of internal conversation happening around this, so I'll post an update when I have one 😄
Relevant discussion: https://expensify.slack.com/archives/C035J5C9FAP/p1655407547697249
No updateyet
@roryabraham are we still planning on doing this?
yes! We are now on our forked equivalent of the upstream RN 0.69.3. As soon as we can turn on Fabric without introducing regressions, we absolutely should!
The flag is there, so we can enable Fabric. We just need to make sure all our dependencies are compatible and test rigorously to make sure we don't break things.
Oh, nice! We should get ahead of that and migrate away from setNativeProps
usages ASAP.
Agreed. @rushatgabhane i'll create an issue, do you want me to just assign you, or would you prefer a contributor take it on?
Another one:
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
Ok. So it is going to be some cleanup work. Please tag me on the issue, I want to track its progress.
do you want me to just assign you
@stitesExpensify yess, that'd be great! It'll require a lot of regression testing but it should be fun.
Will also need to redo https://github.com/Expensify/App/pull/10334 before we can turn on Fabric (it caused a crash as was reverted)
I'm stuck here 😂. I'm trying to move setNativeProps
to state.
Which prop of View do I need to use to set method
and action
?
cc: @parasharrajat any insights?
This is a good topic for slack. You will have to use the form element instead of View
or Text
in the web-specific file.
OR
Just set the attribute via setAttribute
.
I guess setAttribute
is better.
Just set the attribute via setAttribute
Yes, that works. Thank you so much! @parasharrajat
@parasharrajat are you interested in reviewing PR #10934?
If yes, @stitesExpensify could you please assign him to the PR?
Its a big one but I am up for it.
@stitesExpensify is out of the office this week, FYI. Feel free to pull the trigger on puller bear for the internal assignment portion.
Thanks for letting us know.
As per @luacmartins' suggestion -
I split the migration of setNativeProps
PR https://github.com/Expensify/App/pull/10934 into the following PRs to make reviews and testing easier.
Let me know if I missed something.
cc: @parasharrajat I wrote all the tests, but I'll add the screenshots by next week (low bandwidth). I hope that's ok.
I am confused about this issue. the Expected result can't be achieved in one PR.
We should break this into multiple issues.
Yeah, it might be helpful to start treating this issue more like a main/tracking issue. The OP containing a checklist of the prerequisite issues we need to complete to be in a position to actually enable Fabric. That said, outside of deprecating SetNativeProps
, do we have any other prerequisites that need to be completed at this point?
Currently, I only know these.
do we have any other prerequisites that need to be completed at this point?
Yes!
I agree with @trjExpensify that we should use this issue as a tracking issue. I went ahead and created separate issues for each setNativeProps
migration and assigned them to you @rushatgabhane. I also updated the OP to track them and the existing PRs to link to the issues as well.
@rushatgabhane are there any other existing issues or PRs for the other requirements in these lists?
Thanks for creating the issues!
are there any other existing issues or PRs for the other requirements in these lists?
@luacmartins I don't believe so.
Quick question here and sorry if it's already been mentioned...
But why is setNativeProps()
not supported in fabric? And rather than refactor everything to not use it - did we explore just stubbing it in somehow so we can unlock using fabric now and then change all the components later?
But why is setNativeProps() not supported in fabric?
Not too sure. The docs just mention that it's not supported 😭 They also mention that Fabric Native Components achieve similar results to setNativeProps.
did we explore just stubbing it in somehow so we can unlock using fabric now and then change all the components later?
I didn't explore any alternative solutions yet, but maybe @rushatgabhane did? I remember that when implementing Form setNativeProps
was the only solution that worked on native without using state, but I don't recall the specific reason.
It would be good to rule out any obvious alternatives, but nothing is really coming to mind. Not entirely sure how you'd implement a setNativeProps()
. Maybe it is less work than I am imagining it will be.
Maybe the best thing is to just start with one migration and verify performance does not get worse. Then again now sure how easy that will be since we'd maybe need to refactor all components to even start using the new version 😅
Asked for alternatives in react working group. https://github.com/reactwg/react-native-new-architecture/discussions/77
And added a feedback for docs to mention why it was deprecated in the first place https://github.com/reactwg/react-native-new-architecture/discussions/8#discussioncomment-3670468
Going to co-assign here and help out, particularly when it comes to upgrading our fork as needed. Working on a PR to upgrade to 0.70.2
(based on 0.70.1
in the upstream)
This is tied to WN, so I'm updating the priority label on this tracker to weekly
for updates. As per this thread, adding a bullet to the OP for:
Added a new section for dependency upgrades we'll need. One that stands out is that we'll need to upgrade to Reanimated 3, which is still in beta but will probably enter LTS soon
Reanimated 3 will be the first version of the library that supports the new React Native architecture — Fabric
I am also waiting on Reanimated for jest tests.
Updated this issue to include a requirement to address this warning:
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17
Unless I'm mistaken, we can't get the benefits from Fabric unless we are actually using React 18
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead
@roryabraham is anyone working on this? If no, then I could do the chore.
I'm assuming this a react-native-web
only problem.
Using createRoot
and hydrateRoot
from react-dom/client
should do the trick.
(source: react-working-group)
The changes will be made in Expensify's fork - RN-web/render/index.js
Updated this issue to include a requirement to address this warning:
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17
Unless I'm mistaken, we can't get the benefits from Fabric unless we are actually using React 18
This is a react-dom
(renderer) warning. Fabric is only for react-native
(renderer)
We should still address it, but it's not relevant to the Fabric architecture
(React 18 is the core, but the renderer implementations like native
and dom
are independent)
Looks like there is a PR already for it https://github.com/necolas/react-native-web/pull/2330. we can wait for the RN-web to release support for React 18.
there is a PR already for it
That's very convenient :)
Added https://github.com/Expensify/App/issues/11635 to the issue description
GitHub Project: https://github.com/orgs/Expensify/projects/35
Main New Arch PR: https://github.com/Expensify/App/pull/13767
Context
New render engine: https://reactnative.dev/architecture/fabric-renderer Summary of findings 1) There are 4 main components of RN: React, JavaScript, a series of elements collectively known as the “bridge”, and the native elements/modules. Each of these components are getting complimentary upgrades. 2) The notable React upgrades discussed are concurrent rendering, synchronous event callbacks, and priority rendering queues. Together those improvements basically allow for the UI thread to perform heavy rendering work in the background without compromising quick response times to user events such as scrolling and navigation gestures. 3) In the existing RN architecture, the JS and native sides are essentially unaware of each other. All communications are serialized JSON messages sent asynchronously over the bridge. 4) When JavaScript communicates with a web browser, the browser objects hold direct references to native input elements which are controlled internally by the browser. So an HTML checkbox in a browser actually internally holds a reference to a native macOS or Windows checkbox that’s managed by the browser. Similarly, JSI (JavaScript Interface) is a new piece of RN that enables direct communication between JS and the native side, because JSI internally manages direct references to C++ host objects (similar to the HTMLInput element on a browser). This means that messages sent between JS and native modules no longer need to be JSON-serialized or sent over the single bottleneck communication channel. It also means messages can be sent either synchronously or asynchronously. 6) At a high level, the traditional RN bridge manages two tasks: computing layout via a component tree called the “shadow tree” (that shadows the React tree), and managing native modules such as the camera. In the new architecture, these are broken into two distinct pieces which facebook is calling Fabric and TurboModules, respectively. 6) Fabric, the new UI manager, leverages JSI to create the shadow tree in C++ directly, cutting out the middle man and dramatically improving performance. It also exposes UI operations on both sides, so the native side and JS side can both directly manipulate the shadow tree without having to send serialized messages back and forth across the bridge. 7) In the existing native module system, all the native modules need to be loaded when the app launches so that they’re ready and waiting for commands to be sent over the bridge. Turbo Modules have direct references to native modules via JSI, which gives two main benefits. First, native modules can be lazy-loaded (only when really needed), which should dramatically improve app startup time, especially on apps that use lots of different native modules. Second, once loaded the modules will be more performant because communications no longer need to be JSON-serialized and sent across the bridge. 8) Lastly, there is a tool I don’t fully understand called CodeGen. It leverages TypeScript to generate the interface files needed by Fabric and TurboModules. This compile-time type safety means that the code counterparts from both the native and JS worlds can trust eachother without any runtime checks, which means smaller bundle sizes and faster execution.
Requirements
Migrate off setNativeProps
Migrate off findNodeHandle
Bidirectional scrolling
Dependency upgrades
FastImageno longer in useKnown bugs
Expensify/Expensify Issue URL: Issue reported by: @roryabraham Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1648743262264529