kevinresol / React Native Default Preference
Licence: mit
Use SharedPreference (Android) and UserDefaults (iOS) with React Native over a unified interface
Stars: ✭ 170
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to React Native Default Preference
Secure Pref Manager
Secure Preference Manager for android. It uses various Encryption to protect your application's Shared Preferences.
Stars: ✭ 75 (-55.88%)
Mutual labels: sharedpreferences
React Native Encrypted Storage
React Native wrapper around SharedPreferences and Keychain to provide a secure alternative to Async Storage
Stars: ✭ 110 (-35.29%)
Mutual labels: sharedpreferences
Xpref
A SharedPreferences' wrapper that truly supported sharing data across multi-process
Stars: ✭ 80 (-52.94%)
Mutual labels: sharedpreferences
Contacts
A flutter project with Implementation of a Contacts app in 4 ways (API, Custom, Preferences and Sqflite).
Stars: ✭ 100 (-41.18%)
Mutual labels: sharedpreferences
Secure Preferences
Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure.
Stars: ✭ 1,527 (+798.24%)
Mutual labels: sharedpreferences
Easyandroid
一系列简单、轻量、方便的Android开发工具集合(持续更新中),包括Android动态权限、SharedPreferences、反射、日志、Toast、Bundle、MVP、线程池、Html、图文混排、蒙层引导、拍照、图库选择等
Stars: ✭ 1,039 (+511.18%)
Mutual labels: sharedpreferences
Bulldog
Android library to simplify reading and writing to SharedPreferences, never write code like this anymore prefs.edit().putString("someKey","someString").apply()
Stars: ✭ 133 (-21.76%)
Mutual labels: sharedpreferences
Kripton
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.
Stars: ✭ 110 (-35.29%)
Mutual labels: sharedpreferences
Appdatareader
A library for reading Shared Preferences and Database values within the application.
Stars: ✭ 126 (-25.88%)
Mutual labels: sharedpreferences
Ecno
Ecno is a task state manager built on top of UserDefaults in pure Swift 4.
Stars: ✭ 92 (-45.88%)
Mutual labels: userdefaults
Defaultskit
Simple, Strongly Typed UserDefaults for iOS, macOS and tvOS
Stars: ✭ 1,343 (+690%)
Mutual labels: userdefaults
Persistencekit
Store and retrieve Codable objects to various persistence layers, in a couple lines of code!
Stars: ✭ 121 (-28.82%)
Mutual labels: userdefaults
Multiplatform Preferences
Kotlin Multi Platform Preferences, for android an ios : SharedPreferences & NSUserDefault
Stars: ✭ 76 (-55.29%)
Mutual labels: sharedpreferences
Widgetexamples
A demo project showcasing different types of Widgets created with SwiftUI and WidgetKit.
Stars: ✭ 125 (-26.47%)
Mutual labels: userdefaults
Easysp
A SharedPreferences wrapper that has a fluent interface to store data
Stars: ✭ 75 (-55.88%)
Mutual labels: sharedpreferences
Movieapp
🎬 MovieApp is a Flutter application built to demonstrate the use of modern development tools with best practices implementation like Modularization, BLoC, Dependency Injection, Dynamic Theme, Cache, Shimmer, Testing, Flavor, CI/CD, etc.
Stars: ✭ 117 (-31.18%)
Mutual labels: sharedpreferences
Persistentstorageserializable
Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk.
Stars: ✭ 162 (-4.71%)
Mutual labels: userdefaults
Android Remote Debugger
A library for remote logging, database debugging, shared preferences and network requests
Stars: ✭ 132 (-22.35%)
Mutual labels: sharedpreferences
Prefs
Simple Android SharedPreferences wrapper.
Stars: ✭ 125 (-26.47%)
Mutual labels: sharedpreferences
react-native-default-preference
Use SharedPreferences
(Android) and UserDefaults
(iOS) with React Native over a unified interface.
All data is stored as a string. If you need to support more complex data structures, use serialization/deserialization (e.g. JSON).
Getting started
$ npm install react-native-default-preference --save
React Native >= 0.60
$ cd ios && pod install
React Native <= 0.59
$ react-native link react-native-default-preference
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-default-preference
and addRNDefaultPreference.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNDefaultPreference.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.kevinresol.react_native_default_preference.RNDefaultPreferencePackage;
to the imports at the top of the file - Add
new RNDefaultPreferencePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-default-preference' project(':react-native-default-preference').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-default-preference/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-default-preference')
Usage
import DefaultPreference from 'react-native-default-preference';
DefaultPreference.get('my key').then(function(value) {console.log(value)});
DefaultPreference.set('my key', 'my value').then(function() {console.log('done')});
API
function get(key:String):Promise<String>;
function set(key:String, value:String):Promise<Void>;
function clear(key:String):Promise<Void>;
function getMultiple(keys:Array<String>):Promise<Array<String>>;
function setMultiple(data:Object):Promise<Void>;
function clearMultiple(keys:Array<String>):Promise<Void>;
function getAll():Promise<Object>;
function clearAll():Promise<Void>;
/** Gets and sets the current preferences file name (android) or user default suite name (ios) **/
function getName():Promise<String>;
function setName(name:String):Promise<Void>;
Cordova Native Storage Compatibility
This module is compatible with cordova-plugin-native-storage.
Android
You need to use the same SharedPreference as in the cordova plugin, to do so add the following line:
import { Platform } from 'react-native';
// ...
if (Platform.OS === 'android') DefaultPreference.setName('NativeStorage');
iOS
You don't need to change the name, as cordova-plugin-native-storage uses the default value.
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].