sriraman / React Native Shared Preferences
Android's Native key value storage system in React Native
Stars: ✭ 101
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to React Native Shared Preferences
Hoarder
A simple, api-driven storage system for storing code builds and cached libraries for cloud-based deployment services.
Stars: ✭ 91 (-9.9%)
Mutual labels: storage
Incubator Pegasus
['pɛgəsəs] A distributed key-value storage system developed and maintained by Xiaomi Cloud Storage Team.
Stars: ✭ 1,346 (+1232.67%)
Mutual labels: storage
Umbracofilesystemproviders.azure
☁️ An Azure Blob Storage IFileSystem provider for Umbraco
Stars: ✭ 94 (-6.93%)
Mutual labels: storage
Vault
Easy persistence of Contentful data for Android over SQLite.
Stars: ✭ 80 (-20.79%)
Mutual labels: storage
Laravel Storage
A simple filesystem abstraction package for Laravel 4.
Stars: ✭ 100 (-0.99%)
Mutual labels: storage
Now Storage
Use Now static deployments to upload and store files.
Stars: ✭ 91 (-9.9%)
Mutual labels: storage
Go Storage
An application-oriented unified storage layer for Golang.
Stars: ✭ 87 (-13.86%)
Mutual labels: storage
Pufferdb
🐡 An Android & JVM key-value storage powered by Protobuf and Coroutines
Stars: ✭ 91 (-9.9%)
Mutual labels: storage
Turms
The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs
Stars: ✭ 97 (-3.96%)
Mutual labels: storage
Ngx Indexed Db
A service that wraps IndexedDB database in an Angular service. It exposes very simple observables API to enable the usage of IndexedDB without most of it plumbing.
Stars: ✭ 84 (-16.83%)
Mutual labels: storage
React Native Firebase
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Stars: ✭ 9,674 (+9478.22%)
Mutual labels: storage
Space Sdk
The Space SDK is a JavaScript/Typescript library for building web and mobile applications leveraging Open Web and distributed protocols like IPFS, Textile, GunDB, and Ethereum.
Stars: ✭ 93 (-7.92%)
Mutual labels: storage
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+1251.49%)
Mutual labels: storage
React Native Shared Preferences
Android's Native key value storage system in React Native
Installation
< RN 0.47
npm install [email protected] --save
>= RN 0.47
npm install react-native-shared-preferences --save
Project setup and initialization
- In
android/settings.gradle
...
include ':react-native-shared-preferences', ':app'
project(':react-native-shared-preferences').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-shared-preferences/android')
- In
android/app/build.gradle
...
dependencies {
/* YOUR DEPENDENCIES HERE */
compile "com.facebook.react:react-native:+"
compile project(":react-native-shared-preferences") // <--- add this
}
- Register Module (in MainApplication.java)
import in.sriraman.sharedpreferences.RNSharedPreferencesReactPackage; // <--- import
public class MainActivity extends ReactActivity {
......
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSharedPreferencesReactPackage() // <--- Add this
);
}
......
}
Usage
Import
var SharedPreferences = require('react-native-shared-preferences');
Configure name of preferences file. (Optional. Must be called before other functions.)
SharedPreferences.setName("name");
Set Item
SharedPreferences.setItem("key","value");
Get an value
SharedPreferences.getItem("key", function(value){
console.log(value);
});
Get multiple items
SharedPreferences.getItems(["key1","key2"], function(values){
console.log(values)
});
Get all values
SharedPreferences.getAll(function(values){
console.log(values);
});
Clear all values
SharedPreferences.clear();
Get all keys - returns promise with array of keys
SharedPreferences.getAllKeys(function(keys){
console.log(keys);
});
Remove Item
SharedPreferences.removeItem("key");
Credits
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].