Skip to main content
Re-watch the latest React Native Keynote from React Conf 2025
This is documentation for React Native 0.84, which is no longer in active development.
For up-to-date documentation, see the latest version (0.85).
Version: 0.84

Settings

Settings serves as a wrapper for NSUserDefaults, a persistent key-value store available only on iOS.

Exampleโ€‹


Reference

Methodsโ€‹

clearWatch()โ€‹

tsx
static clearWatch(watchId: number);

watchId is the number returned by watchKeys() when the subscription was originally configured.


get()โ€‹

tsx
static get(key: string): any;

Get the current value for a given key in NSUserDefaults.


set()โ€‹

tsx
static set(settings: Record<string, any>);

Set one or more values in NSUserDefaults.


watchKeys()โ€‹

tsx
static watchKeys(keys: string | array<string>, callback: () => void): number;

Subscribe to be notified when the value for any of the keys specified by the keys parameter has been changed in NSUserDefaults. Returns a watchId number that may be used with clearWatch() to unsubscribe.

note

watchKeys() by design ignores internal set() calls and fires callback only on changes preformed outside of React Native code.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.