mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Disable legacy native modules in bridgeless mode
Summary: Requiring legacy native modules fails in bridgeless mode because they use the batched bridge, so we need to check for turbomodules first to avoid crashing. In D15703655 I reversed the order of this check for everyone, but this had some unintended side effects (everyone got turbomodules). This time I'm just using my flag to check for bridgeless mode so we can bail out of legacy native modules instead. Reviewed By: fkgozali Differential Revision: D15857106 fbshipit-source-id: 9d33161ae059e7a357f135c82b6865f4d2a57add
This commit is contained in:
committed by
Facebook Github Bot
parent
1de206f36f
commit
c19c6cef3f
@@ -17,10 +17,13 @@ import invariant from 'invariant';
|
||||
const turboModuleProxy = global.__turboModuleProxy;
|
||||
|
||||
export function get<T: TurboModule>(name: string): ?T {
|
||||
// Backward compatibility layer during migration.
|
||||
const legacyModule = NativeModules[name];
|
||||
if (legacyModule != null) {
|
||||
return ((legacyModule: any): T);
|
||||
// Bridgeless mode requires TurboModules
|
||||
if (!global.RN$Bridgeless) {
|
||||
// Backward compatibility layer during migration.
|
||||
const legacyModule = NativeModules[name];
|
||||
if (legacyModule != null) {
|
||||
return ((legacyModule: any): T);
|
||||
}
|
||||
}
|
||||
|
||||
if (turboModuleProxy != null) {
|
||||
|
||||
Reference in New Issue
Block a user