0

Is there any way to check if Asyncstorage is available in any React native project? Something like window.localstorage on web...

Cristian Flórez
  • 2,277
  • 5
  • 29
  • 51
  • If you depend on AsyncStorage and your package will not run without it, you should take a look at peer dependencies https://nodejs.org/es/blog/npm/peer-dependencies/ If not, there is this method: https://stackoverflow.com/a/15303236/5793132 which works great on node, but haven't tried it on a react-native project. – Ugur Eren Feb 24 '21 at 23:11
  • in react native doesnt work the second method, thrown the following error: `global.require is not a function. (In 'global.require( '@react-native-async-storage/async-storage')', 'global.require' i s undefined)`. I don't know if the first method can work, I don't know how the application would verify that AsyncStorage is available in production, in the final app bundle? – Cristian Flórez Feb 24 '21 at 23:29

0 Answers0