04-03-2019 11:15
04-03-2019 11:15
Is there a reason why this code:
settingsStorage.onchange = function(evt){
console.log(evt);
}produce this output with a TextInput setting?
{
isTrusted: false,
key: 'APIKey',
newValue: '{"name":"abc"}',
oldValue: '{"name":"ab"}'
} instead for a Toggle setting this?
{
isTrusted: false,
key: 'FollowMe',
newValue: 'false',
oldValue: 'true'
}Why in the values there is a json string for the TextInput setting?
My settings:
<Page>
<Section title="Weather and forecast settings"
description={<Text> Obtain a free api key at <Link source="http://www.weatherbit.io">www.weatherbit.io</Link></Text>}>
<Toggle
settingsKey="FollowMe"
label="Follow me"
/>
<TextInput
label="City"
placeholder="Turin"
action="Save"
type="text"
settingsKey="CityName"
disabled={!(props.settings.FollowMe === "false")}
/>
<TextInput
label="API key"
placeholder="[api key from weatherbit.io]"
action="Save"
type="text"
settingsKey="APIKey"
/>
</Section>
</Page>
Answered! Go to the Best Answer.
04-04-2019 10:30
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
04-04-2019 10:30
We are aware of the inconsistency, but we are currently unable to change it without affecting existing apps. Hopefully it will be resolved at some point though.
In the meantime, you could store the value manually, instead of using the automatic `settingsKey` property.
<TextInput
value={{ name: this.props.settingsStorage.getItem('your-text-value') || 'default value' }}
onChange={(value) => {
this.props.settingsStorage.setItem('your-text-value', value.name);
}}
/>
04-04-2019 10:30
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
04-04-2019 10:30
We are aware of the inconsistency, but we are currently unable to change it without affecting existing apps. Hopefully it will be resolved at some point though.
In the meantime, you could store the value manually, instead of using the automatic `settingsKey` property.
<TextInput
value={{ name: this.props.settingsStorage.getItem('your-text-value') || 'default value' }}
onChange={(value) => {
this.props.settingsStorage.setItem('your-text-value', value.name);
}}
/>