fix(lib/modules/native): getNativeModule should fallback to legacy if turbo module doesn't exist
This commit is contained in:
parent
3563daed39
commit
e0c2ca7d6c
1 changed files with 5 additions and 5 deletions
|
|
@ -10,11 +10,11 @@ const turboModuleProxy = globalThis.__turboModuleProxy
|
|||
* @param name The name of the native module to get.
|
||||
*/
|
||||
export function getNativeModule<T>(name: string): T | null {
|
||||
const module = turboModuleProxy
|
||||
? // Non-bridgeless with TurboModules
|
||||
turboModuleProxy(name)
|
||||
: // Bridgeless & legacy modules
|
||||
nativeModuleProxy[name]
|
||||
const module =
|
||||
// Non-bridgeless with TurboModules
|
||||
turboModuleProxy?.(name) ??
|
||||
// Bridgeless & legacy modules
|
||||
nativeModuleProxy[name]
|
||||
|
||||
if (module) return module as T
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue