Skip to content

Commit 7938919

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Remove usage of getShadowNodeClass() on new architecture
Summary: This diff removes the usage of getShadowNodeClass() on apps that are purely running on the new architecture. The implications of this change are: - all shadow node classes will be stripped-out by proguard - props exposed in shadow Nodes won't be included in the native view configs, this is fine becuase all core components are already using static view configs, props included in LayoutShadow node are covered by: BaseViewConfig.android.js changelog: [internal] internal Reviewed By: javache, cortinico, rshest Differential Revision: D72602551 fbshipit-source-id: caada701f80253830df0085fdbbac47a2aa6d71b
1 parent b095336 commit 7938919

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.facebook.react.bridge.ReadableArray;
2222
import com.facebook.react.bridge.ReadableMap;
2323
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
24+
import com.facebook.react.common.build.ReactBuildConfig;
2425
import com.facebook.react.common.mapbuffer.MapBuffer;
2526
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
2627
import com.facebook.react.touch.JSResponderHandler;
@@ -406,6 +407,11 @@ public void receiveCommand(@NonNull T root, String commandId, @Nullable Readable
406407
* Map contains the names (key) and types (value) of the ViewManager's props.
407408
*/
408409
public Map<String, String> getNativeProps() {
410+
if (ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE
411+
&& ReactNativeFeatureFlags.enableBridgelessArchitecture()
412+
&& ReactNativeFeatureFlags.disableShadowNodeOnNewArchitectureAndroid()) {
413+
return ViewManagerPropertyUpdater.getNativeProps(getClass(), null);
414+
}
409415
return ViewManagerPropertyUpdater.getNativeProps(getClass(), getShadowNodeClass());
410416
}
411417

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ public object ViewManagerPropertyUpdater {
8484
@JvmStatic
8585
public fun getNativeProps(
8686
viewManagerTopClass: Class<out ViewManager<Nothing, *>>,
87-
shadowNodeTopClass: Class<out Nothing>
87+
shadowNodeTopClass: Class<out Nothing>?
8888
): Map<String, String> {
8989
val props: MutableMap<String, String> = HashMap()
9090
findManagerSetter(viewManagerTopClass).getProperties(props)
91-
findNodeSetter(shadowNodeTopClass).getProperties(props)
91+
if (shadowNodeTopClass != null) {
92+
findNodeSetter(shadowNodeTopClass).getProperties(props)
93+
}
9294
return props
9395
}
9496

0 commit comments

Comments
 (0)