A framework for building native applications using React
Calculate Android mounting instructions based on updates accumulated in rawProps (#48303)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48303 ## Context If a component is re-rendered/committed multiple times before mount, Android mounting layer creates and executes mounting instructions for every commit. Component's native representation is updated multiple times, potentially triggering expensive computations (e.g. recreating boxShadows) for a single draw. A more efficient way would be to create mounting instructions to update the component from the initial state (before the first render) to the final state (after the last render) in one go. iOS does that. This diff is an attempt to experiment on achieving such behaviour for Android. ## Implementation Details 1. When cloning a ShadowNode, accumulate all the updates in `Props.rawProps`. 2. For calculating prop update payloads to be sent to the Android mounting layer, diff old and new `rawProps` by calling `newProps->getDiffProps(oldProps)`. 3. Most importantly, move computing of the mounting instructions from `schedulerDidFinishTransaction`, which is called after every commit, to `schedulerShouldRenderTransactions` which happens only once, after the final commit. Changelog: [Internal] Reviewed By: javache Differential Revision: D63457028 fbshipit-source-id: 991727838a4e11628cb696d66d41e1d441a5ef4f
D
Dmitry Rykun committed
0ceb0b3942fea284d590d9bc15e01b944ee3ad55
Parent: 5c789c3
Committed by Facebook GitHub Bot <[email protected]>
on 12/17/2024, 5:03:08 PM