mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor preComputeConstantsForViewManager to avoid loading UIManagerModule in Fabric
Summary: This method refactors the preComputeConstantsForViewManager to avoid loading UIManagerModule when using Fabric + Static View configs changelog: [internal] internal Reviewed By: shergin Differential Revision: D25468182 fbshipit-source-id: e95b0e7d013e832792fb77fc0b6e5705d7f04868
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4c734d1e8d
commit
b3defc8872
@@ -294,14 +294,16 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
* Helper method to pre-compute the constants for a view manager. This method ensures that we
|
||||
* don't block for getting the constants for view managers during TTI
|
||||
*
|
||||
* @deprecated this method will not be available in FabricUIManager class.
|
||||
* @deprecated this method will be removed in the future
|
||||
* @param viewManagerNames {@link List<String>} names of ViewManagers
|
||||
*/
|
||||
@Deprecated
|
||||
public void preComputeConstantsForViewManager(List<String> viewManagerNames) {
|
||||
// TODO T81145457 - Implement pre-initialization of ViewManagers in Fabric Android
|
||||
@Override
|
||||
public void preInitializeViewManagers(List<String> viewManagerNames) {
|
||||
if (ReactFeatureFlags.enableExperimentalStaticViewConfigs) {
|
||||
preInitializeViewManagers(viewManagerNames);
|
||||
for (String viewManagerName : viewManagerNames) {
|
||||
mUIImplementation.resolveViewManager(viewManagerName);
|
||||
}
|
||||
// When Static view configs are enabled it is not necessary to pre-compute the constants for
|
||||
// viewManagers, although the pre-initialization of viewManager objects is still necessary
|
||||
// for performance reasons.
|
||||
@@ -326,12 +328,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
mViewManagerConstantsCache = Collections.unmodifiableMap(constantsMap);
|
||||
}
|
||||
|
||||
private void preInitializeViewManagers(List<String> viewManagerNames) {
|
||||
for (String viewManagerName : viewManagerNames) {
|
||||
mUIImplementation.resolveViewManager(viewManagerName);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public @Nullable WritableMap getConstantsForViewManager(@Nullable String viewManagerName) {
|
||||
if (mViewManagerConstantsCache != null
|
||||
|
||||
Reference in New Issue
Block a user