Repository navigation
Commit 9fe2ff5
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
0 commit comments