-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove non-layout style and prop updates path via synchronouslyUpdatePropsOnUIThread
#7014
base: main
Are you sure you want to change the base?
Remove non-layout style and prop updates path via synchronouslyUpdatePropsOnUIThread
#7014
Conversation
synchronouslyUpdateUIPropsFunction_
call in performOperations
synchronouslyUpdatePropsOnUIThread
path for non-layout prop updates
synchronouslyUpdatePropsOnUIThread
path for non-layout prop updatessynchronouslyUpdatePropsOnUIThread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, should we also merge/rework props lists in TS?
packages/react-native-reanimated/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp
Outdated
Show resolved
Hide resolved
@tjzel We'll need to discuss this. There's no need to keep separate sets for UI and native props (since I've merged the logic of applying UI and native props) but I think we still need to expose |
@tomekzaw We can keep both these methods and mark one of them as deprecated. |
Motivation
Currently, there are two ways to update native view props and styles in Reanimated. The default path (so-called slow path) is to apply all props changes to the ShadowTree via C++ API and let React Native mount the changes. However, if all props updated in given batch are non-layout props (i.e. those that don't require layout recalculation, like background color or opacity) we use a fast path that calls
synchronouslyUpdatePropsOnUIThread
from React Native and applies the changes directly to platform views, without making changes to ShadowTree in C++. Turns out, some features like view measurement or touch detection system use C++ ShadowTree which is not consistent with what's currently on the screen. Because of that, we're removing the fast path (turns out it's not that fast, especially on iOS) to restore the correctness of view measurement and touch detection for animated components.Benchmarks
transform
prop usinguseAnimatedStyle
App.tsx
Summary
Test plan