2.0.0 • Published 2 years ago

react-native-property-editor v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-property-editor

If you have a small collection of key-values that you'd like to save, you can use the UserDefaults (on iOS) or SharedPreferences (on Android) APIs. A UserDefaults / SharedPreferences object points to a file containing key-value pairs and provides simple methods to read and write them.

Installation

npm install react-native-property-editor
# or 
yarn add react-native-property-editor

# Link for iOS
cd ios && pod install

Usage

import PropertyEditor from 'react-native-property-editor';

// ...

const [text, setText] = React.useState<string | undefined>();

PropertyEditor.getString('prop-key').then(setText);

// ...

<Button
  title="Set Value"
  onPress={() => PropertyEditor.setString('prop-key', 'new-value')}
/>

Methods

Callback NameDescriptionParameters
setContextNameSet context name (Has no effect on iOS)contextName: string
getNumberGet number value. If the value is absent 0 will be returnedkey: string
setNumberSet number valuekey: string, value: number
getStringGet string value. If the value is absent undefined will be returnedkey: string
setStringSet string valuekey: string, value: string
getBooleanGet boolean value. If the value is absent false will be returnedkey: string
setBooleanSet boolean valuekey: string, value: bool

License

MIT


Made with create-react-native-library

2.0.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0-b1

2 years ago