Enable prop diffing for <View> (#45551)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45551

This diffs toggles the new Android prop diffing mechanism for <View> components

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D59613243

fbshipit-source-id: 79c1e4bf4f5a67fc516e5db7b9f4ffba0cb9b69b
This commit is contained in:
David Vacca
2024-07-20 10:23:12 -07:00
committed by Facebook GitHub Bot
parent a052e1eefd
commit 9af63956d2
@@ -220,6 +220,17 @@ static inline float scale(Float value, Float pointScaleFactor) {
jni::local_ref<jobject> FabricMountingManager::getProps(
const ShadowView& oldShadowView,
const ShadowView& newShadowView) {
auto componentName = newShadowView.componentName;
// We calculate the diffing between the props of the last mounted ShadowTree
// and the Props of the latest commited ShadowTree). ONLY for <View>
// components when the "enablePropsUpdateReconciliationAndroid" feature flag
// is enabled.
if (ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid() &&
strcmp(componentName, "View") == 0) {
const Props* oldProps = oldShadowView.props.get();
auto diffProps = newShadowView.props->getDiffProps(oldProps);
return ReadableNativeMap::newObjectCxxArgs(diffProps);
}
return ReadableNativeMap::newObjectCxxArgs(newShadowView.props->rawProps);
}