react-native-mmkv-storage
Version:
This library aims to provide a fast & reliable solution for you data storage needs in react-native apps. It uses [MMKV](https://github.com/Tencent/MMKV) by Tencent under the hood on Android and iOS both that is used by their WeChat app(more than 1 Billion
28 lines (27 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mmkvBridgeModule = void 0;
//@ts-ignore
const isDebugMode = global.location && global.location.pathname && global.location.pathname.includes('/debugger-ui');
exports.mmkvBridgeModule = !isDebugMode
? require('react-native').NativeModules.MMKVNative
: {
install: () => {
console.warn(`Remote debugging is not supported by JSI modules. MMKV is running with a memory adapter currently and is fully functional for testing only. Hence any values will not persist on App refresh/reload. `);
require('../../../jest/dist/jest/memoryStore.js').mock();
return true;
}
};
/**
* All jsi functions bound to global object.
*
* The last param `id` is the instance id of the storage instance we want to get/set the value.
*
* `undefined`: It means that instance is not loaded
*
* `null`: Value does not exist or some error occured while getting the value
*
*/
//@ts-ignore
const mmkvJsiModule = global;
exports.default = mmkvJsiModule;