I am having an issue related to react-native-asyncstorage from here:
https://facebook.github.io/react-native/docs/asyncstorage.html
When I run react-native run-ios
, the following error appears:
I am using react-native 0.52.0 and this problem may be due to the dependency of react-native-asyncstorage:
[email protected] requires a peer of
react-native@^0.47.2 but none is installed. You must install peer
dependencies yourself.
The odd thing is it works fine for Android, but not for both iOS nor iOS emulator.
Can someone help?
EDIT
I would like to add some points that maybe useful:
- I use Expo for development,
- I have commented every AsyncStorage in my code, but the problem still persist,
- As asked in the comment, here is the snipped code of my AsyncStorage code
-
import { AsyncStorage } from 'react-native';
export async function SetItem(strKey, objValue) {
try {
if (typeof(objValue) === 'string') {
await AsyncStorage.setItem(strKey, objValue);
}
else {
await AsyncStorage.setItem(strKey, JSON.stringify(objValue));
}
}
catch(error){
console.log(error);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…