New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-temp-storage

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-temp-storage

simple package to store string value in native side for temporary, to be used after bundle reload.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

react-native-temp-storage

Simple package to store data in native side for temporary. So it will be available after hot-reload, bundle restart, but not app restart

Installation

npm install react-native-temp-storage

or

yarn add react-native-temp-storage

iOS

npx pod-install

Usage

import { useState } from 'react';
import { StyleSheet, View, Text, Button } from 'react-native';
import * as TempStorage from 'react-native-temp-storage';

export default function App() {
  const [result, setResult] = useState<string | undefined>();

  return (
    <View style={styles.container}>
      <Text>Result: {result}</Text>
      <Button
        title="set Color Red"
        onPress={() => TempStorage.setItem('color', 'Red')}
      />
      <Button
        title="set Taste sweet"
        onPress={() => TempStorage.setItem('taste', 'Sweet')}
      />
      <Button
        title="set Color Blue"
        onPress={() => TempStorage.setItem('color', 'Blue')}
      />
      <Button
        title="delete Color"
        onPress={() => TempStorage.deleteItem('color')}
      />
      <Button
        title="delete Taste"
        onPress={() => TempStorage.deleteItem('taste')}
      />
      <Button
        title="get Color"
        onPress={() => TempStorage.getItem('color').then(setResult)}
      />
      <Button
        title="get Taste"
        onPress={() => TempStorage.getItem('taste').then(setResult)}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});

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

Keywords

react-native

FAQs

Package last updated on 30 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts