From 980aa152c5b073349fc488ab672cf0933984be75 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Date: Thu, 21 Mar 2024 11:15:04 -0300 Subject: [PATCH] Implement multiple view manager lookup for the interop layer on Android --- .../com/facebook/react/uimanager/ViewManagerRegistry.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java index 1f3c219250a71f..418a52ec77cfda 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java @@ -53,10 +53,18 @@ public ViewManagerRegistry(Map viewManagerMap) { * @return the {@link ViewManager} registered to the className received as a parameter */ public synchronized ViewManager get(String className) { + // 1. Try to get the manager without the prefix. ViewManager viewManager = mViewManagers.get(className); if (viewManager != null) { return viewManager; } + + // 2. Try to get the manager with the RCT prefix. + String rctViewManagerName = "RCT" + className; + viewManager = mViewManagers.get(rctViewManagerName); + if (viewManager != null) { + return viewManager; + } if (mViewManagerResolver != null) { viewManager = getViewManagerFromResolver(className); if (viewManager != null) return viewManager;