Android Shared Preferences for React Native
npm install @connected-home/react-native-android-shared-preferences --save
# or...
yarn add @connected-home/react-native-android-shared-preferences
react-native link @connected-home/react-native-android-shared-preferences
const SharedPreferences = require("react-native-android-shared-preferences");
// or...
import SharedPreferences from "react-native-android-shared-preferences";
SharedPreferences.getItem("file", "key", value => {
...
});
SharedPreferences.getItems("file", ["key1", "key2"], values => {
...
});
SharedPreferences.keys("file", keys => {
...
});
SharedPreferences.entries("file", entries => {
console.log(values);
});
SharedPreferences.setItem("file", "key", "value");
SharedPreferences.deleteItem("file", "key");
SharedPreferences.clear("file");
SharedPreferences.deleteFile("file");