10-16-2017 14:36
10-16-2017 14:36
as described on API here
“changes from the companion application will trigger events to be emitted in the settings view”
but I can NOT have them refreshed accordingly.
can anyone tell me how to refresh them from companion?
e.g.
companion/index.js
settingsStorage.clear();
settingsStorage.setItem("alwayson", JSON.stringify("false"));
settings/index.jsx
<Toggle settingsKey="alwayson" label="Keep Backlight Always On" />
no matter what I do, the toggle button keep displaying as "on", "true"
after first user clicking, it works and sending out value correctly, the problem happens on the VERY FIRST run
do I have some code to force refresh them and make them display accordingly?
I've tried import settingsStorage in settings/index.jsx like this but failed.
import { settingsStorage } from "settings";
Answered! Go to the Best Answer.
10-17-2017 08:40
10-17-2017 08:40
I haven't worked with the toggle component yet, but are you certain that you are sending in the correct value? JSON.stringify("false") is going to send in ""false"", which might evaluate to true. Do you mean to send in JSON.stringify(false)?
10-17-2017 08:40
10-17-2017 08:40
I haven't worked with the toggle component yet, but are you certain that you are sending in the correct value? JSON.stringify("false") is going to send in ""false"", which might evaluate to true. Do you mean to send in JSON.stringify(false)?
10-17-2017 09:22
10-17-2017 09:22
Oh, my bad. I've tried JSON.stringify(false) and confirmed it works!
Thank you!
Now my first app is ready for review.