An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
MIT License
Bot releases are visible (Hide)
Published by ammarahm-ed about 3 years ago
Published by ammarahm-ed about 3 years ago
useMMKVStorage
change when removeItem
is calledgetAllMMKVInstanceIDs
and getCurrentMMKVInstanceIDs
to module levelhasKey
functions in indexer are now synchronouskey
and/or storage
in useMMKVStorage
hook at runtimeclearMemoryCache
functiongetKey
function to get encryption key of current MMKV instancecreate
function.defaultValue
for useMMKVStorage
hook.null
exception during migration if value for a key was nullsetValue
not stable in useMMKVStorage
hook #157useMMKVStorage
hook could not be changed after it was deleted.1.2.10
Transactions
Listen to a value's lifecycle and mutate it on the go. Transactions lets you register lifecycle functions with your storage instance such as onwrite
, beforewrite
, onread
, ondelete
. This allows for a better and more managed control over the storage and also let's you build custom indexes with a few lines of code. Refer to #104 issue more detail on this feature.
storage.transactions.register("object","onwrite",(key,value) => {
//do something
})
Remember that these are not events but functions. If you register the same type of function twice, the later will take precedence.
useIndex
A hook that will take an array of keys and returns an array of values for those keys. This is supposed to work in combination with Transactions. When you have build your custom index, you will need an easy and quick way to load values for your index. useIndex hook actively listens to all read/write changes and updates the values accordingly.
const [posts, update,remove] = useIndex(postsIndex,"object",storage);
Published by ammarahm-ed over 3 years ago
create
function not imported correctly.Published by ammarahm-ed over 3 years ago
create
function which you can use to create a useMMKVStorage
hook.useMMKVStorage
hook now supports setter functions. #98 Thanks to @SaltedBlowfishPublished by ammarahm-ed over 3 years ago
clearStore
#95Published by ammarahm-ed over 3 years ago
useMMKVStorage
hookremoveItem
& clearStore
methods to sync.Published by ammarahm-ed over 3 years ago
Fixed build failing on android #91
Published by ammarahm-ed over 3 years ago
useMMKVStorage
Hook ๐Thanks to the power of JSI, we now have our very own useMMKVStorage Hook. Think of it like a persisted state that will always write every change in storage and update your app UI instantly. It doesn't matter if you reload the app or restart it. Here's a small demo:
Import MMKVStorage
and useMMKVStorage
Hook.
import MMKVStorage, { useMMKVStorage } from "react-native-mmkv-storage";
Initialize the MMKVStorage
instance.
const MMKV = new MMKVStorage.Loader().initialize();
Next, in our component we are going to register our hook.
const App = () => {
const [user, setUser] = useMMKVStorage("user", MMKV);
return (
<View>
<Text>{user}</Text>
</View>
);
};
To update value of "user"
in storage and your App
component will automatically rerender.
setUser("andrew");
// or you can do this too anywhere in the app:
MMKV.setString("user", "andrew");
Head over to the docs for complete usage.
hasKey
functions in the indexer are now synchronousPublished by ammarahm-ed over 3 years ago
This release fixes a lot of issues with JSI and hopefully the library should build normally now in debug and release.
Published by ammarahm-ed over 3 years ago
Fix some users were unable to build project on android. #62
Fix app crash when chrome debugger is connected.
Fix data from 0.4 version was not readable.
Published by ammarahm-ed over 3 years ago
Fix old database from v0.4
is not detected
Don't clear keychain on iOS
Published by ammarahm-ed over 3 years ago
Fixing setItem and getItem methods not working
Fix CMakeLists.txt file is missing in npm module.
Don't forget to run pod install
after upgrading
Published by ammarahm-ed over 3 years ago
This is a rewrite of library in C++ using JSI. Read/Write can now be as fast as 0.05ms!
Don't forget to run pod install
after upgrading
Published by ammarahm-ed over 3 years ago
Published by ammarahm-ed almost 4 years ago
Published by ammarahm-ed almost 4 years ago
In the pervious versions of the library, if value for a key was not present, promise would reject and hence you had to wrap all your calls in try/catch. From version 0.4.1 onwards we will use a fallback value null
when value for a key does not exist to make things simpler.
Published by ammarahm-ed about 4 years ago
Published by ammarahm-ed about 4 years ago
Published by ammarahm-ed over 4 years ago
minSdkVersion
to 16
on AndroidPublished by ammarahm-ed over 4 years ago