New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typerror: withCustomKey is not working #18
Comments
|
Thanks for reporting this! There is actually nothing such as Use this: const MMKVwithEncryptionKey = new MMKVStorage.Loader().withEncryption().encryptWithCustomKey('encryptionKey').initialize(); |
Without |
Thanks, understood. I'm using it this way now. // src/store/mmkv.js
import MMKVStorage from 'react-native-mmkv-storage';
class MMKV {
constructor() {
this.instance = new MMKVStorage.Loader().withEncryption();
this.MMKV = null;
}
initialize = async () => {
this.MMKV = await this.instance.initialize();
};
setMapAsync = async (name, value) => {
return this.MMKV.setMapAsync(name, value);
};
getMapAsync = async (name) => {
return this.MMKV.getMapAsync(name);
};
}
export default new MMKV(); // App.js
import 'react-native-gesture-handler';
import React, {useEffect} from 'react';
import {View, StyleSheet} from 'react-native';
import RNBootSplash from 'react-native-bootsplash';
import AppNavigator from './src/navigation/AppNavigator';
import {MMKV, dispatch} from './src/store';
export default function App() {
useEffect(() => {
MMKV.initialize().then(async () => {
try {
const settings = await MMKV.getMapAsync('settings');
dispatch({type: 'settings', settings});
} catch (err) {
console.log(err.message);
} finally {
RNBootSplash.hide({duration: 250}); // fade
}
});
}, []);
return (
<View style={styles.container}>
<AppNavigator />
</View>
);
} // other components
import {MMKV} from './src/store'; Btw thanks for the library, just what I wanted :) |
I will look into it and see if we can make the API directly exposed without async, because async is creating some problems especially with |
What folder is this? I mean the path? @sayem314 |
It's storing data inside |
I don't think the document directory is exposed in any file manager directly. Its the App's document directory right? Then I don't understand why are you exposing this directory to the user? |
In iOS there are no other directories for storing flat files, in fact after exposing iTunes file sharing this path is shared on both iTunes and files. On android it's possible to expose another directory but not for iOS. A while ago I have used realm and they don't seem to host on that, not sure where realm data is stored tho. |
can a folder be hidden? @sayem314 |
In-App I can hide it. But since my app downloads files and plays contents in-app I must expose it to the Files app and iTunes, no workaround for iOS. I can use realm but it adds about 5 MB and is meant for complex databases. If you can't change the path I would request you to add |
@sayem314 I will look into it and see what we can do about it. |
Example code:
The text was updated successfully, but these errors were encountered: