Skip to content

Commit abdad34

Browse files
jcguarinpenarandanatanrolnik
authored andcommitted
Adding support for RN 0.50+ (#504)
Added other try-catch to require the correct library for React Native 0.50+, as posted on [#496](#496)
1 parent 06c7c83 commit abdad34

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/StorageController.react-native.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ try {
1717
// for React Native 0.43+
1818
AsyncStorage = require('react-native/Libraries/react-native/react-native-implementation').AsyncStorage;
1919
} catch (error) {
20-
AsyncStorage = require('react-native/Libraries/react-native/react-native.js').AsyncStorage;
20+
try {
21+
AsyncStorage = require('react-native/Libraries/react-native/react-native.js').AsyncStorage;
22+
} catch(error) {
23+
// for React Native 0.50+
24+
AsyncStorage = require('react-native/Libraries/Storage/AsyncStorage');
25+
}
2126
}
2227

2328
var StorageController = {

0 commit comments

Comments
 (0)