From 92f8fd22e2c45f6b8e714a8c50819fc1c7f8568b Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 24 May 2019 11:22:09 -0700 Subject: [PATCH] Optimize the update of state during first render of a View Summary: This is an optimization to avoid transfering updateState instructions twice during the frist render of a view (same a props) Reviewed By: shergin Differential Revision: D15476041 fbshipit-source-id: 8a62035dbbb63c93f86a2f8d217986a325cb1805 --- .../java/com/facebook/react/fabric/jni/Binding.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 286392d5590..4effb64e1a0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -458,6 +458,12 @@ void Binding::schedulerDidFinishTransaction( deletedViewTags.end()) { mountItems[position++] = createUpdatePropsMountItem(javaUIManager_, mutation); + + // State + if (mutation.newChildShadowView.state) { + mountItems[position++] = + createUpdateStateMountItem(javaUIManager_, mutation); + } } // LocalData @@ -472,12 +478,6 @@ void Binding::schedulerDidFinishTransaction( if (updateLayoutMountItem) { mountItems[position++] = updateLayoutMountItem; } - - // State - if (mutation.newChildShadowView.state) { - mountItems[position++] = - createUpdateStateMountItem(javaUIManager_, mutation); - } } // EventEmitter