Skip to content

Remove ViewManagerWithGeneratedInterface from old arch interfaces #3584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geraintwhite
Copy link
Contributor

@geraintwhite geraintwhite commented Jun 30, 2025

Description

Fixes #3564

Remove unneeded ViewManagerWithGeneratedInterface extend from old arch to preserve backwards compatibility with RN 0.77

Test plan

App builds and runs on RN 0.77 with old arch with this patch.

@shashank-bhatotia
Copy link

Fix Confirmed - ViewManagerWithGeneratedInterface Interface Issue

I encountered this exact same issue with React Native 0.74.3 and [email protected]. After digging deep into the compilation errors, here's what I found and how to fix it:

Root Cause

The issue occurs because ViewManagerWithGeneratedInterface is only available in the new architecture (Fabric), but the Java interface files are trying to extend it even when using the old architecture (newArchEnabled=false).

Specifically, these two files have problematic interface definitions:

  • node_modules/react-native-gesture-handler/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java
  • node_modules/react-native-gesture-handler/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java

Solution

The fix is to remove the extends ViewManagerWithGeneratedInterface clause from both interface files, which is exactly what this PR #3584 addresses (good job, @geraintwhite 🎊).

Manual Fix:

  1. In RNGestureHandlerButtonManagerInterface.java, change:

    public interface RNGestureHandlerButtonManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {

    to:

    public interface RNGestureHandlerButtonManagerInterface<T extends View> {
  2. Do the same for RNGestureHandlerRootViewManagerInterface.java

  3. Remove the corresponding import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface; lines

Permanent Solution with patch-package:

# After making the manual changes above
npm install patch-package --save-dev
npx patch-package react-native-gesture-handler

# Add to package.json scripts
"postinstall": "patch-package"

Why This Works

The ViewManagerWithGeneratedInterface is only needed for the new architecture's generated interfaces. For the old architecture, the interfaces work perfectly fine without extending this class, and removing the inheritance resolves the compilation errors.

Tested with:

  • React Native 0.74.3
  • react-native-gesture-handler 2.27.2
  • Android Gradle Plugin 8.6.0
  • Gradle 8.7
  • Old Architecture (newArchEnabled=false)

Build now completes successfully with no functional impact on gesture handling.

Commenting here because #3564 is closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants