Skip to content

alipman88/react-native-cross-platform-settings

Repository files navigation

react-native-cross-platform-settings

Cross-platform implementation of React Native's Settings API

Installation

yarn add react-native-cross-platform-settings

Usage

React Native provides a Settings API, acting as a persistent key–value data store with synchronous reads: https://reactnative.dev/docs/settings

However, the Settings API is only available to iOS applications. This package adds Android support, wrapping Android's SharedPreferences for storage.

import { Settings } from 'react-native-cross-platform-settings';

Settings.set({ name: 'Aaron' });
Settings.get('name')
// 'Aaron'

Note that the watchKeys and clearWatch functions are not supported on Android.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library