gun
gun copied to clipboard
[Question/Concern] React Native Warning: No localStorage exists to persist data to!
Hey guys,
After doing the react-native set up as per instructions, I am getting the warning Warning: No localStorage exists to persist data to!
but everything seems to be working as expected.
Brought it up to the very helpful chat on discord and everything I tried still results in the same warning.
It looks like the problematic lines are here:
var root, noop = function(){}, store, u;
try{store = (Gun.window||noop).localStorage}catch(e){}
if(!store){
Gun.log("Warning: No localStorage exists to persist data to!");
store = {setItem: function(k,v){this[k]=v}, removeItem: function(k){delete this[k]}, getItem: function(k){return this[k]}};
}
Is this something to worry about?
Thanks in advance!
@3210jr good catch! That code assumes browser only environment. IDK off top of head how to fix... since it is true localStorage
does not exist in React Native (why you need AsyncStorage), but please PR if you have a simple idea. To get rid of the log, just Gun({localStorage: false
to turn off (tho make sure this doesn't quit AsyncStorage either lol)