react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI

MIT License

Downloads
75.4K
Stars
1.6K
Committers
54

Bot releases are visible (Hide)

react-native-mmkv-storage - v0.6.2

Published by ammarahm-ed about 3 years ago

  • Fix build failing on App Center, App Circle & Gitlab etc. #160
  • Simplify cmake build
react-native-mmkv-storage - v0.6.1

Published by ammarahm-ed about 3 years ago

  • Trigger useMMKVStorage change when removeItem is called
  • move getAllMMKVInstanceIDs and getCurrentMMKVInstanceIDs to module level
  • hasKey functions in indexer are now synchronous
  • Allow changing when key and/or storage in useMMKVStorage hook at runtime
  • Add clearMemoryCache function
  • Add getKey function to get encryption key of current MMKV instance
  • Prevent a possible crash when sending incorrect parameters to create function.
  • Do not recompile jsi.cpp from source on Android
  • Now you can set a defaultValue for useMMKVStorage hook.
  • Fix a null exception during migration if value for a key was null
  • Fix numerous build issues on Android such as #155
  • Fix setValue not stable in useMMKVStorage hook #157
  • Fix value type of useMMKVStorage hook could not be changed after it was deleted.
  • Refactor and simplify some parts of the library
  • Update MMKV to 1.2.10

What's new

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);
react-native-mmkv-storage - v0.6.0

Published by ammarahm-ed over 3 years ago

Fixed

  1. Null exception while migrating if value for key is null
  2. create function not imported correctly.
  3. Trigger useMMKVStorage change when removeItem is called Thanks @frw
  4. improved types definition for useMMKVStorage hook Thanks @Thanaen
react-native-mmkv-storage - v0.5.9

Published by ammarahm-ed over 3 years ago

What's new

  1. The library now exports a simple create function which you can use to create a useMMKVStorage hook.
  2. The useMMKVStorage hook now supports setter functions. #98 Thanks to @SaltedBlowfish

What's fixed

  1. useMMKVStorage return value if it exists on init #105 by @vokhuyetOz
  2. Minor fixes in the docs.
react-native-mmkv-storage - v0.5.8

Published by ammarahm-ed over 3 years ago

  1. Fixed unable to access storage after calling clearStore #95
react-native-mmkv-storage - v0.5.7

Published by ammarahm-ed over 3 years ago

  1. Fix return type on useMMKVStorage hook to pass ts typecheck script #92 @mateosilguero & @mmapplebeck
  2. Removed console.log from useMMKVStorage hook
  3. Convert removeItem & clearStore methods to sync.
react-native-mmkv-storage - v0.5.6

Published by ammarahm-ed over 3 years ago

Fixed build failing on android #91

react-native-mmkv-storage - v0.5.5

Published by ammarahm-ed over 3 years ago

Introducing 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.

What's Fixed:

  1. Fix #64 especially on iOS on reloading app when MMKV was not registered on JSI
  2. Updated docs to correctly install library along with react-native-reanimated. #89 #90 @r0b0t3d
  3. All hasKey functions in the indexer are now synchronous

react-native-mmkv-storage - v0.5.4

Published 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.

  1. Rewrite keystore & keychain Logic in JSI to make synchronous initialization possible.
  2. Fixed need type definitions for callback function params #79 @mateosilguero
  3. FIxed return types for all functions that write to database. #75
  4. Fixed Crash in release build due to java.lang.UnsatisfiedLinkError: Bad JNI version returned from JNI_OnLoad #68
  5. Fixed build failing on android for some build environments #67
  6. Fix app crashing when using clearStorage #82 @focux
  7. Update docs to reflect latest changes and installation process
  8. Fixed release build on ios failed due to lower deployment target.

Follow the updated installation steps for v0.5.4

react-native-mmkv-storage - 0.5.3

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.

Follow installation steps for v0.5.0 and above

react-native-mmkv-storage - v0.5.2

Published by ammarahm-ed over 3 years ago

Fix old database from v0.4 is not detected
Don't clear keychain on iOS

react-native-mmkv-storage - v0.5.1

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

react-native-mmkv-storage - v0.5.0

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

No Breaking Changes

react-native-mmkv-storage - v0.4.4

Published by ammarahm-ed over 3 years ago

  • Fix indexer crashes on ios #57
  • Fix setAccessibleMode is actually called setAccessibleIOS #56
  • Provide null as possible type for get operations #58 by @hannojg
react-native-mmkv-storage - v0.4.3

Published by ammarahm-ed almost 4 years ago

react-native-mmkv-storage - v0.4.1

Published by ammarahm-ed almost 4 years ago

In this version

  1. Updated MMKV to version 1.2.4 Thanks to @mateosilguero
  2. Remove unused parameters and call imports in different files. Thanks to @luism3861
  3. Fix incorrect peerDependancy warning Thanks to @sayem314
  4. Fix an issue where app would crash if value for a string was set to null.
  5. Change rootDir on iOS to "Library" instead of "Documents" so it does not appear in File Manager.

Breaking Change

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.

react-native-mmkv-storage - v0.3.7

Published by ammarahm-ed about 4 years ago

What's Fixed

  1. Encryption on android. fixed #30
react-native-mmkv-storage - v0.3.6

Published by ammarahm-ed about 4 years ago

What's New

  1. Update MMKV to 1.2.2
react-native-mmkv-storage - v0.3.5

Published by ammarahm-ed over 4 years ago

What's New

  1. Updated MMKV to 1.2.1 since 1.2.0 was removed due to a critical bug. #29 #28 Thanks to @hoanglam10499
  2. Reduce minSdkVersion to 16 on Android
react-native-mmkv-storage - v0.3.3

Published by ammarahm-ed over 4 years ago

What's New

  1. Fix xcode release build errors by updating MMKV to 1.2.0 #24
  2. Fix #26 use dispatch_get_main_queue on ios