From 1c0b3f8872ec7defb63e37920cb431c9a5fc5740 Mon Sep 17 00:00:00 2001 From: Grant Bishop Date: Wed, 4 May 2022 06:46:09 -0700 Subject: [PATCH 1/2] Fix for AsyncStorage deprecation. --- README.md | 2 +- default-opts.js | 2 +- mock-react-native/package.json | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0bf332..98819ef 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Create a file called index.js and enter the following: import asyncstorageDown from 'asyncstorage-down' import levelup from 'levelup' // or whichever implementation you're using -import AsyncStorage from '@react-native-community/async-storage' +import AsyncStorage from '@react-native-async-storage/async-storage' const db = levelup('/does/not/matter', { db: location => asyncstorageDown(location, { AsyncStorage }) diff --git a/default-opts.js b/default-opts.js index c076d3d..ccf6f8f 100644 --- a/default-opts.js +++ b/default-opts.js @@ -1,5 +1,5 @@ module.exports = { get AsyncStorage() { - return require('react-native').AsyncStorage + return require('@react-native-async-storage/async-storage').AsyncStorage } } diff --git a/mock-react-native/package.json b/mock-react-native/package.json index 4bd7ed7..7f10702 100644 --- a/mock-react-native/package.json +++ b/mock-react-native/package.json @@ -1,5 +1,5 @@ { - "name": "react-native", + "name": "@react-native-async-storage/async-storage", "description": "A fake React Native package to contain the mock for AsyncStorage", "version": "0.0.0", "main": "index.js" diff --git a/package.json b/package.json index 287f9d9..3fc8476 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,11 @@ "tiny-queue": "0.2.0" }, "devDependencies": { + "@react-native-async-storage/async-storage": "file:./mock-react-native", "asyncstorage-mock-another": "^1.0.1", "eslint": "^5.9.0", "husky": "^1.1.3", "levelup": "^1.3.0", - "react-native": "file:./mock-react-native", "tape": "^4.6.3" }, "repository": { From 18e3d45e0bbc675000f142c0c94a816d27fcf510 Mon Sep 17 00:00:00 2001 From: Grant Bishop Date: Wed, 4 May 2022 06:53:59 -0700 Subject: [PATCH 2/2] Fix for default require issue. --- default-opts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default-opts.js b/default-opts.js index ccf6f8f..d5f7705 100644 --- a/default-opts.js +++ b/default-opts.js @@ -1,5 +1,5 @@ module.exports = { get AsyncStorage() { - return require('@react-native-async-storage/async-storage').AsyncStorage + return require('@react-native-async-storage/async-storage').default } }