I'm trying to get the below select item to display the currently selected currency. I originally tried doing that using `props.settingStorage.getItem('currency')` which works initially but when selected a second time it returns `{"values":[{"name":"USD"}],"selected":[1]}` although per the SDK documentation it should simply return `"USD"` or `"EUR"`.
On a side note, I also want to point out that the Toggle example, copied verbatim from the SDK docs does not work. I also tried modifying it, but the code string is simply displayed entirely without being processed.
What am I doing wrong?
<Select
label={`Currency: ${props.settingStorage.getItem('currency')}`}
settingsKey="currency"
options={[
{ name: 'EUR' },
{ name: 'USD' }
]}
renderItem={
(option) =>
<TextImageRow
label={option.name}
/>
}
/>
{/* <Toggle
label={`Currency: ${settings.toggle === 'EUR' ? 'on' : 'off'}`}
settingsKey="curr"
onChange={(value) => { props.settingsStorage.setItem('currency', value === true ? "EUR" : "USD") }}
/> */}Answered! Go to the Best Answer.
Best AnswerFitbit changed something in the way it returns some information. See if this thread helps...
https://community.fitbit.com/t5/SDK-Development/Settings-changed-w
Best AnswerFitbit changed something in the way it returns some information. See if this thread helps...
https://community.fitbit.com/t5/SDK-Development/Settings-changed-w
Best AnswerThank you! That was very helpful. It would mean a lot to the dev community if the SDK docs were updated (and the devs warned) to reflect such changes. Currently it feels like I constantly have to walk the trial-and-error path with Fitbit which isn't really the way to code. Especially because you have to manage to keep three devices connected while developing.
Best AnswerFor the record, this is the full link (it got truncated in your post):
https://community.fitbit.com/t5/SDK-Development/Settings-changed-what-it-returns/m-p/2940019#M6064
Best Answer