… is that a normal behavior?
Regards & thanks
… is that a normal behavior?
Regards & thanks
hi! this is not normal behavior. what is watchdog?
also, please provide a mcve (How to create a Minimal, Reproducible Example - Help Center - Stack Overflow) so we can repro ourselves and help debug
Hi notbrent,
watchdog observes changes in the sourcecode and restarts the app after changes automatically.
I store user informations in the SecureStore API part of Expo.
setCredits(c){
this.credits = c;
try{
Expo.SecureStore.setItemAsync(CREDITS_STORAGE_ID,this.credits);
}catch(e){
console.log("Expo.Secure issue:",this.credits);
console.log("Expo.Secure issue:",CREDITS_STORAGE_ID);
console.log("Expo.Secure issue:",e);
}
}
Later, when I try to read from the SecureStorage in the next session(after restart the app), I get a “null” value.
Expo.SecureStore.getItemAsync(CREDITS_STORAGE_ID).then((data)=>{
console.log("Storage content:",data);
});
The code lines are part of an es6 class and running in same scope.
why would you use watchdog and not the built-in livereload?
I thought watchdog is built-in.
it seems expo tries to youse watchdog, if exists. sometimes I get an error, that watchdog isn’t running.
but I think, thats not the topic.
right, so the code you provided is far from a mcve (How to create a Minimal, Reproducible Example - Help Center - Stack Overflow) - i tried it and substituted the variables that weren’t defined with random values and it worked as expected. please read and follow the mcve link that i sent.
here’s the code that i ran:
import React from 'react';
import { Button, View, Text } from 'react-native';
import { SecureStore } from 'expo';
export default class Example extends React.Component {
state = { thing: '' }
render() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>{this.state.thing ? this.state.thing : ''}</Text>
<Button title="Save the thing" onPress={this._save} />
<Button title="Get the thing" onPress={this._get} />
</View>
);
}
_save = async () => {
await SecureStore.setItemAsync('lol', 'example');
alert('saved!')
};
_get = async () => {
let result = await SecureStore.getItemAsync('lol');
this.setState({ thing: result })
};
}
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.