Skip to content

Commit 9af6395

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Enable prop diffing for <View> (#45551)
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
1 parent a052e1e commit 9af6395

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,17 @@ static inline float scale(Float value, Float pointScaleFactor) {
220220
jni::local_ref<jobject> FabricMountingManager::getProps(
221221
const ShadowView& oldShadowView,
222222
const ShadowView& newShadowView) {
223+
auto componentName = newShadowView.componentName;
224+
// We calculate the diffing between the props of the last mounted ShadowTree
225+
// and the Props of the latest commited ShadowTree). ONLY for <View>
226+
// components when the "enablePropsUpdateReconciliationAndroid" feature flag
227+
// is enabled.
228+
if (ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid() &&
229+
strcmp(componentName, "View") == 0) {
230+
const Props* oldProps = oldShadowView.props.get();
231+
auto diffProps = newShadowView.props->getDiffProps(oldProps);
232+
return ReadableNativeMap::newObjectCxxArgs(diffProps);
233+
}
223234
return ReadableNativeMap::newObjectCxxArgs(newShadowView.props->rawProps);
224235
}
225236

0 commit comments

Comments
 (0)