From 483dea80478e83c295c8806c69ae72b4384299d7 Mon Sep 17 00:00:00 2001 From: Corey Henderson Date: Mon, 27 May 2019 21:55:37 -0600 Subject: [PATCH] Add react-native-storage-wrapper back with the proper patch Also opened up a PR to the author: https://github.com/mondora/react-native-storage-wrapper/pull/1 --- package-lock.json | 5 ++++ package.json | 1 + .../react-native-storage-wrapper+0.1.0.patch | 10 ++++++++ src/common.js | 2 +- src/components/CanvassingPage/index.js | 2 +- src/components/CanvassingSetupPage/index.js | 2 +- src/components/CreateSurveyPage/index.js | 2 +- src/components/LegacyCanvassingPage/index.js | 2 +- src/components/LegacySurveyPage/index.js | 2 +- src/components/SettingsPage/index.js | 2 +- src/components/SurveyPage/index.js | 2 +- src/components/storage.js | 25 ------------------- 12 files changed, 24 insertions(+), 33 deletions(-) create mode 100644 patches/react-native-storage-wrapper+0.1.0.patch delete mode 100644 src/components/storage.js diff --git a/package-lock.json b/package-lock.json index 0ebd9356..5a4a530c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6253,6 +6253,11 @@ "resolved": "https://registry.npmjs.org/react-native-sortable-listview/-/react-native-sortable-listview-0.2.8.tgz", "integrity": "sha512-1zEzgMHv32w4oGNEMuwHRxK8uGYQjJeufwq/2ispmRYctR1oGc0eDgg/WSPChdNlInw4cpK/fPRd6sfLPHP1Kw==" }, + "react-native-storage-wrapper": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/react-native-storage-wrapper/-/react-native-storage-wrapper-0.1.0.tgz", + "integrity": "sha1-gyj+Q4Lt4zI/2RKAVhatKVaa17U=" + }, "react-native-swipeout": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/react-native-swipeout/-/react-native-swipeout-2.3.6.tgz", diff --git a/package.json b/package.json index ee5d3174..80c730ed 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "react-native-simple-modal": "^9.0.1", "react-native-snap-carousel": "^3.8.0", "react-native-sortable-listview": "^0.2.8", + "react-native-storage-wrapper": "^0.1.0", "react-native-swipeout": "^2.3.6", "react-native-vector-icons": "^6.4.2", "react-navigation": "^3.11.0", diff --git a/patches/react-native-storage-wrapper+0.1.0.patch b/patches/react-native-storage-wrapper+0.1.0.patch new file mode 100644 index 00000000..93cfde0a --- /dev/null +++ b/patches/react-native-storage-wrapper+0.1.0.patch @@ -0,0 +1,10 @@ +diff --git a/node_modules/react-native-storage-wrapper/src/index.js b/node_modules/react-native-storage-wrapper/src/index.js +index d5e6d37..a58153f 100644 +--- a/node_modules/react-native-storage-wrapper/src/index.js ++++ b/node_modules/react-native-storage-wrapper/src/index.js +@@ -1,4 +1,4 @@ +-import {AsyncStorage} from "react-native"; ++import AsyncStorage from '@react-native-community/async-storage'; + + module.exports = { + get (key) { diff --git a/src/common.js b/src/common.js index d32f9492..1e22b717 100644 --- a/src/common.js +++ b/src/common.js @@ -6,7 +6,7 @@ import { View, } from 'react-native'; -import storage from './components/storage'; +import storage from 'react-native-storage-wrapper'; import jwt_decode from 'jwt-decode'; import DeviceInfo from 'react-native-device-info'; import RNGooglePlaces from 'react-native-google-places'; diff --git a/src/components/CanvassingPage/index.js b/src/components/CanvassingPage/index.js index 9916424b..fa7a76e1 100644 --- a/src/components/CanvassingPage/index.js +++ b/src/components/CanvassingPage/index.js @@ -22,7 +22,7 @@ import OVComponent from '../OVComponent'; import Accordion from 'react-native-collapsible/Accordion'; import { BottomNavigation } from 'react-native-material-ui'; import { NavigationActions } from 'react-navigation'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import NetInfo from '@react-native-community/netinfo'; import DeviceInfo from 'react-native-device-info'; import Icon from 'react-native-vector-icons/FontAwesome'; diff --git a/src/components/CanvassingSetupPage/index.js b/src/components/CanvassingSetupPage/index.js index a3815fa8..64f58ba0 100644 --- a/src/components/CanvassingSetupPage/index.js +++ b/src/components/CanvassingSetupPage/index.js @@ -16,7 +16,7 @@ import { import t from 'tcomb-form-native'; import sha1 from 'sha1'; import Modal from 'react-native-simple-modal'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import Swipeout from 'react-native-swipeout'; import Icon from 'react-native-vector-icons/FontAwesome'; import SafariView from 'react-native-safari-view'; diff --git a/src/components/CreateSurveyPage/index.js b/src/components/CreateSurveyPage/index.js index e4f4915b..6ff87649 100644 --- a/src/components/CreateSurveyPage/index.js +++ b/src/components/CreateSurveyPage/index.js @@ -22,7 +22,7 @@ import OVComponent from '../OVComponent'; import { BottomNavigation } from 'react-native-material-ui'; import t from 'tcomb-form-native'; import Modal from 'react-native-simple-modal'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import SortableListView from 'react-native-sortable-listview' import Permissions from 'react-native-permissions'; import RNGLocation from 'react-native-google-location'; diff --git a/src/components/LegacyCanvassingPage/index.js b/src/components/LegacyCanvassingPage/index.js index ccec6247..27f4ecd4 100644 --- a/src/components/LegacyCanvassingPage/index.js +++ b/src/components/LegacyCanvassingPage/index.js @@ -22,7 +22,7 @@ import { NavigationActions } from 'react-navigation'; import { BottomNavigation } from 'react-native-material-ui'; import { Dropbox } from 'dropbox'; import DeviceInfo from 'react-native-device-info'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import NetInfo from '@react-native-community/netinfo'; import Icon from 'react-native-vector-icons/FontAwesome'; import sha1 from 'sha1'; diff --git a/src/components/LegacySurveyPage/index.js b/src/components/LegacySurveyPage/index.js index e607d74f..a02fb231 100644 --- a/src/components/LegacySurveyPage/index.js +++ b/src/components/LegacySurveyPage/index.js @@ -13,7 +13,7 @@ import { ScrollView, } from 'react-native'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import { BottomNavigation } from 'react-native-material-ui'; import t from 'tcomb-form-native'; import sha1 from 'sha1'; diff --git a/src/components/SettingsPage/index.js b/src/components/SettingsPage/index.js index fdbddca6..5740e6de 100644 --- a/src/components/SettingsPage/index.js +++ b/src/components/SettingsPage/index.js @@ -22,7 +22,7 @@ import RNGooglePlaces from 'react-native-google-places'; import ModalPicker from 'react-native-modal-selector'; import Modal from 'react-native-simple-modal'; import Icon from 'react-native-vector-icons/FontAwesome'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import SmLoginPage from '../SmLoginPage'; import { Dropbox } from 'dropbox'; import { google_api_key } from '../../config'; diff --git a/src/components/SurveyPage/index.js b/src/components/SurveyPage/index.js index c6b880cf..46c5b06f 100644 --- a/src/components/SurveyPage/index.js +++ b/src/components/SurveyPage/index.js @@ -17,7 +17,7 @@ import { getEpoch, getPropFromArrObj } from '../../common'; import {BackHandler} from 'react-native'; import { BottomNavigation } from 'react-native-material-ui'; -import storage from '../storage'; +import storage from 'react-native-storage-wrapper'; import t from 'tcomb-form-native'; import sha1 from 'sha1'; diff --git a/src/components/storage.js b/src/components/storage.js deleted file mode 100644 index 177e7dc7..00000000 --- a/src/components/storage.js +++ /dev/null @@ -1,25 +0,0 @@ -import AsyncStorage from '@react-native-community/async-storage'; - -// code taken from https://github.com/mondora/react-native-storage-wrapper - -module.exports = { - get (key) { - return AsyncStorage.getItem(key) - .catch(err => { - throw new Error(`[react-native-storage-wrapper] - ${err}`); - }); - }, - set (key, value) { - return AsyncStorage.setItem(key, value) - .catch(err => { - throw new Error(`[react-native-storage-wrapper] - ${err}`); - }); - }, - del (key) { - return AsyncStorage.removeItem(key) - .catch(err => { - throw new Error(`[react-native-storage-wrapper] - ${err}`); - }); - } -}; -