Coder Social home page Coder Social logo

react-native-property-editor's Introduction

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 Name Description Parameters
setContextName Set context name (Has no effect on iOS) contextName: string
getNumber Get number value. If the value is absent 0 will be returned key: string
setNumber Set number value key: string, value: number
getString Get string value. If the value is absent undefined will be returned key: string
setString Set string value key: string, value: string
getBoolean Get boolean value. If the value is absent false will be returned key: string
setBoolean Set boolean value key: string, value: bool

License

MIT


Made with create-react-native-library

react-native-property-editor's People

Contributors

lane-lu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.