Skip to content

Commit

Permalink
Enable prop diffing for <View> (#45551)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
mdvacca authored and facebook-github-bot committed Jul 20, 2024
1 parent a052e1e commit 9af6395
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9af6395

Please sign in to comment.