From 7158aa8bed080608ec8fde7062b93d0a878d1663 Mon Sep 17 00:00:00 2001 From: Laura Macaluso Date: Fri, 24 Jul 2026 05:55:11 -0700 Subject: [PATCH] Fix UnsatisfiedLinkError in BaseViewManagerDelegateTest (#57665) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57665 Constructing a `ReactViewGroup` now reads the `syncAndroidClipBoundsWithOverflow` feature flag: the `pointerEvents` setter calls `ImportantForInteractionHelper.setImportantForInteraction`, which reads that flag, and `initView()` sets `pointerEvents`. Reading a feature flag loads the native `react_featureflagsjni` library, which is not on the Robolectric library path for this test, so `BaseViewManagerDelegateTest.setUp()` fails with: ``` java.lang.UnsatisfiedLinkError: no react_featureflagsjni ``` Install the local (non-native) feature-flags accessor in `setUp()` via `ReactNativeFeatureFlagsForTests.setUp()` and reset it in `tearDown()`, matching the approach already used in `ImportantForInteractionHelperTest`. Changelog: [Internal] Reviewed By: fabriziocucci, javache Differential Revision: D113543605 --- .../react/uimanager/BaseViewManagerDelegateTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java index 6de844d1e5c9..13ad5c6a95c3 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java @@ -12,8 +12,11 @@ import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactTestHelper; +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests; import com.facebook.react.views.view.ReactViewGroup; import com.facebook.react.views.view.ReactViewManager; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,6 +30,9 @@ public class BaseViewManagerDelegateTest { @Before public void setUp() { + // Constructing a ReactViewGroup reads a native-backed feature flag; install the local + // (non-JNI) accessor so Robolectric doesn't try to load react_featureflagsjni. + ReactNativeFeatureFlagsForTests.INSTANCE.setUp(); viewManager = mock(ReactViewManager.class); ReactApplicationContext context = ReactTestHelper.createCatalystContextForTest(); ThemedReactContext themedReactContext = new ThemedReactContext(context, context, null, -1); @@ -34,6 +40,11 @@ public void setUp() { delegate = new BaseViewManagerDelegate<>(viewManager) {}; } + @After + public void tearDown() { + ReactNativeFeatureFlags.dangerouslyReset(); + } + @Test public void setOutlineColorConvertsDoubleToInt() { int color = 0xFF336699;