mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix RNTester SampleLegacyModule not rendering in Old Arch (#51073)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51073 Currently the SampleLegacyModule screen is not loading in OldArch for RNTester. That's because we gate adding a `SampleLegacyModule` to the BaseReactPackage only if NewArch is enabled. This shouldn't be the case as we can still build RNTester in oldarch and we should be able to visualize the SampleLegacyModule example. Changelog: [Internal] [Changed] - Reviewed By: mdvacca Differential Revision: D74009245 fbshipit-source-id: 55eae3dc6063343f57261af2742e643a8e5c2b50
This commit is contained in:
committed by
Facebook GitHub Bot
parent
506f03b5e1
commit
c6685d29ad
+23
-33
@@ -53,45 +53,35 @@ internal class RNTesterApplication : Application(), ReactApplication {
|
||||
override fun getModule(
|
||||
name: String,
|
||||
reactContext: ReactApplicationContext
|
||||
): NativeModule? {
|
||||
if (!isNewArchEnabled) {
|
||||
return null
|
||||
}
|
||||
if (SampleTurboModule.NAME == name) {
|
||||
return SampleTurboModule(reactContext)
|
||||
}
|
||||
if (SampleLegacyModule.NAME == name) {
|
||||
return SampleLegacyModule(reactContext)
|
||||
}
|
||||
return null
|
||||
}
|
||||
): NativeModule? =
|
||||
when {
|
||||
SampleTurboModule.NAME == name -> SampleTurboModule(reactContext)
|
||||
SampleLegacyModule.NAME == name -> SampleLegacyModule(reactContext)
|
||||
else -> null
|
||||
}
|
||||
|
||||
// Note: Specialized annotation processor for @ReactModule isn't configured in OSS
|
||||
// yet. For now, hardcode this information, though it's not necessary for most
|
||||
// modules.
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
|
||||
ReactModuleInfoProvider {
|
||||
if (isNewArchEnabled) {
|
||||
mapOf(
|
||||
SampleTurboModule.NAME to
|
||||
ReactModuleInfo(
|
||||
SampleTurboModule.NAME,
|
||||
"SampleTurboModule",
|
||||
canOverrideExistingModule = false,
|
||||
needsEagerInit = false,
|
||||
isCxxModule = false,
|
||||
isTurboModule = true),
|
||||
SampleLegacyModule.NAME to
|
||||
ReactModuleInfo(
|
||||
SampleLegacyModule.NAME,
|
||||
"SampleLegacyModule",
|
||||
canOverrideExistingModule = false,
|
||||
needsEagerInit = false,
|
||||
isCxxModule = false,
|
||||
isTurboModule = false))
|
||||
} else {
|
||||
emptyMap()
|
||||
}
|
||||
mapOf(
|
||||
SampleTurboModule.NAME to
|
||||
ReactModuleInfo(
|
||||
SampleTurboModule.NAME,
|
||||
"SampleTurboModule",
|
||||
canOverrideExistingModule = false,
|
||||
needsEagerInit = false,
|
||||
isCxxModule = false,
|
||||
isTurboModule = true),
|
||||
SampleLegacyModule.NAME to
|
||||
ReactModuleInfo(
|
||||
SampleLegacyModule.NAME,
|
||||
"SampleLegacyModule",
|
||||
canOverrideExistingModule = false,
|
||||
needsEagerInit = false,
|
||||
isCxxModule = false,
|
||||
isTurboModule = false))
|
||||
}
|
||||
},
|
||||
object : ReactPackage, ViewManagerOnDemandReactPackage {
|
||||
|
||||
Reference in New Issue
Block a user