mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Align View creation flow between Fabric and non-Fabric
Summary: Ship responsibility for most View creation logic to ViewManager, where it already largely lies, and simplify code in Fabric and non-Fabric mounting layers. Notably, some of this work was *already* being duplicated so we can expect an extremely tiny perf gain here. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D26742711 fbshipit-source-id: 4213766d4cd366bc69cd47d4654f7b269bb9e7f4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ea3495399b
commit
a65cd683ae
@@ -122,7 +122,10 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
/**
|
||||
* Subclasses should return a new View instance of the proper type. This is an optional method
|
||||
* that will call createViewInstance for you. Override it if you need props upon creation of the
|
||||
* view.
|
||||
* view, or state.
|
||||
*
|
||||
* <p>If you override this method, you *must* guarantee that you you're handling updateProperties,
|
||||
* view.setId, addEventEmitters, and updateState/updateExtraData properly!
|
||||
*
|
||||
* @param reactTag reactTag that should be set as ID of the view instance
|
||||
* @param reactContext ReactContext used to initialize view instance
|
||||
@@ -140,6 +143,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
if (initialProps != null) {
|
||||
updateProperties(view, initialProps);
|
||||
}
|
||||
// Only present in Fabric; but always present in Fabric.
|
||||
if (stateWrapper != null) {
|
||||
Object extraData = updateState(view, initialProps, stateWrapper);
|
||||
if (extraData != null) {
|
||||
|
||||
Reference in New Issue
Block a user