From 17f8fa319cb91e9c1ef8649d407b384e9b9e9085 Mon Sep 17 00:00:00 2001 From: Palm Date: Fri, 24 Jan 2025 17:05:18 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20NativeModules=20on=20Andr?= =?UTF-8?q?oid=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix NativeModules on Android * Use `getNativeModule()` for `BundleInfo` --- src/api/fs.ts | 2 +- src/api/native.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/fs.ts b/src/api/fs.ts index 98f8b6f..03d035d 100644 --- a/src/api/fs.ts +++ b/src/api/fs.ts @@ -4,7 +4,7 @@ import { getNativeModule } from '@api/native'; export type * from '@typings/api/fs'; -const FileManager: FileManagerType = getNativeModule('DCDFileManager', 'RTNFileManager'); +const FileManager: FileManagerType = getNativeModule('NativeFileModule', 'DCDFileManager', 'RTNFileManager'); export const Documents = FileManager.DocumentsDirPath; diff --git a/src/api/native.ts b/src/api/native.ts index 44b14c3..b85655e 100644 --- a/src/api/native.ts +++ b/src/api/native.ts @@ -4,9 +4,9 @@ import { NativeModules, TurboModuleRegistry } from 'react-native'; export type * from '@typings/api/native'; -export const BundleInfo: BundleInfoType = NativeModules.InfoDictionaryManager ?? NativeModules.RTNClientInfoManager; +export const BundleInfo: BundleInfoType = getNativeModule('NativeClientInfoModule', 'InfoDictionaryManager', 'RTNClientInfoManager'); export const BundleManager: BundleManagerType = getNativeModule('BundleUpdaterManager'); -export const DeviceInfo: DeviceInfoType = getNativeModule('DCDDeviceManager'); +export const DeviceInfo: DeviceInfoType = getNativeModule('NativeDeviceModule', 'DCDDeviceManager'); export async function reload(instant = true) { if (instant) {