Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Settings Select Output Inconsistent?

ANSWERED

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") }}
/> */}
Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Fitbit changed something in the way it returns some information.  See if this thread helps...

 

https://community.fitbit.com/t5/SDK-Development/Settings-changed-w

 

 

View best answer in original post

Best Answer
0 Votes
3 REPLIES 3

Fitbit 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 Answer
0 Votes

Thank 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 Answer
0 Votes

For 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
0 Votes