import {AsyncStorage} from 'react-native' import React, { Component } from 'react'; export default class AsyncStorageHelper extends Component{ async saveData(key, value) { try { await AsyncStorage.setItem(key, JSON.stringify(value)); } catch (error) { console.error('save error'+ error.message); } } async saveString(key, value) { try { await AsyncStorage.setItem(key, value); } catch (error) { console.error('save error'+ error.message); } } async getData(key, callback) { try { var value = await AsyncStorage.getItem(key).then( (values) => { callback(values); } ) } catch (error) { // console.error('get error'); } } async removeItemValue(key) { try { await AsyncStorage.removeItem(key); return true; } catch (exception) { console.log(exception) return false; } } }