Skip to content

Commit af07ed6

Browse files
authored
Switch AsyncStorage to react-native-community/async-storage
AsyncStorage is deprecated by later react-native versions, having been moved out into 'react-native-community/async-storage'. Continuing to use the old react-native/AsyncStorage causes deprecation warnings (yuck!) and will eventually stop working.
1 parent 90949f3 commit af07ed6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/raven-js/plugins/react-native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function reactNativePlugin(Raven, options) {
144144
* Returns a promise that guarantees never to reject.
145145
*/
146146
reactNativePlugin._persistPayload = function(payload) {
147-
var AsyncStorage = require('react-native').AsyncStorage;
147+
var AsyncStorage = require('@react-native-community/async-storage').default;
148148
return AsyncStorage.setItem(ASYNC_STORAGE_KEY, stringify(payload))['catch'](function() {
149149
return null;
150150
});
@@ -156,7 +156,7 @@ reactNativePlugin._persistPayload = function(payload) {
156156
* Returns a promise that guarantees never to reject.
157157
*/
158158
reactNativePlugin._restorePayload = function() {
159-
var AsyncStorage = require('react-native').AsyncStorage;
159+
var AsyncStorage = require('@react-native-community/async-storage').default;
160160
var promise = AsyncStorage.getItem(ASYNC_STORAGE_KEY)
161161
.then(function(payload) {
162162
return JSON.parse(payload);
@@ -174,7 +174,7 @@ reactNativePlugin._restorePayload = function() {
174174
* Clears any persisted payloads.
175175
*/
176176
reactNativePlugin._clearPayload = function() {
177-
var AsyncStorage = require('react-native').AsyncStorage;
177+
var AsyncStorage = require('@react-native-community/async-storage').default;
178178
return AsyncStorage.removeItem(ASYNC_STORAGE_KEY)['catch'](function() {
179179
return null;
180180
});

0 commit comments

Comments
 (0)