Skip to content

Commit 9fe2ff5

Browse files
authored
[Android] Register all component descriptors in react-native.config.js (#4521)
## Description `componentDescriptors` in `react-native.config.js` listed only `RNGestureHandlerDetectorComponentDescriptor`. A user-supplied list replaces the CLI's autodetection entirely, so since #3599 the Button and RootView descriptors were never added to the generated `autolinking.cpp` on Android. Both components kept working only because RN's Fabric interop layer creates an `UnstableLegacyViewManagerAutomaticComponentDescriptor` for any unknown component when `useFabricInterop` is on (its default). With the flag off, or with RN built with `RCT_REMOVE_LEGACY_COMPONENT_INTEROP`, `GestureHandlerRootView` and all buttons render as `UnimplementedNativeView`. The Detector is `interfaceOnly`, which is why autodetection never picked it up and the override was needed in the first place. This lists all three descriptors and adds a comment so the next codegen'd component is not silently dropped. No behaviour change on a default RN setup; the codegen'd descriptors are now registered directly instead of through the interop fallback. ## Test plan Verified on basic-example (RN 0.88.0-rc.0, Pixel 9 Pro emulator) with `useFabricInterop` forced to `false` in `MainApplication`: - before: whole screen is a pink `UnimplementedNativeView`, `autolinking.cpp` registers only the Detector - after: Text and Contents Button screens render normally, `autolinking.cpp` registers Button, Detector and RootView Note: Gradle caches `android/build/generated/autolinking/autolinking.json`, so delete `android/build/generated/autolinking` and `android/app/build/generated/autolinking` in the app before rebuilding to pick up the change. <details> <summary>Flag override used for testing</summary> ```kotlin override fun onCreate() { super.onCreate() loadReactNative(this) ReactNativeFeatureFlags.dangerouslyForceOverride( object : ReactNativeFeatureFlagsProvider by ReactNativeFeatureFlagsOverrides_RNOSS_Stable_Android() { override fun useFabricInterop(): Boolean = false } ) } ``` </details>
1 parent 186eb6b commit 9fe2ff5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎packages/react-native-gesture-handler/react-native.config.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ module.exports = {
55
dependency: {
66
platforms: {
77
android: {
8+
// Listing any descriptor disables CLI autodetection, so every one must be here.
89
componentDescriptors: [
10+
'RNGestureHandlerButtonComponentDescriptor',
911
'RNGestureHandlerDetectorComponentDescriptor',
12+
'RNGestureHandlerRootViewComponentDescriptor',
1013
],
1114
cmakeListsPath: './CMakeLists.txt',
1215
},

0 commit comments

Comments
 (0)