08-23-2018 13:07
08-23-2018 13:07
This work good in settings page:
import { LEVELS } from '../resources/common';
function settingsPage(props) {
let whatever = LEVELS[0].whatever;
}This does not work:
<TextImageRow label="label" sublabel="Sub-Label" icon="../resources/icon.png" />
Why can we access JS, but not other resources? Why must icons be loaded from web/url?
Best Answer09-01-2018 10:22
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.
09-01-2018 10:22
You can do an image import like this:
import cat from '../resources/cat.jpg';
function Imports(props) {
return (
<Page>
<Section title="Import Image Example">
<TextImageRow
label="Example image"
icon={cat}
/>
</Section>
</Page>
);
}
registerSettingsPage(Imports);
Best Answer04-21-2019 01:51 - edited 04-21-2019 07:50
04-21-2019 01:51 - edited 04-21-2019 07:50
Hi,
I'm facing the same issue - I'm unable to use my resource images on my settings page.
Is there any requirement for the images? I'm trying to use my 8-bit grayscale png icons, as per the docs.
Using the image from the Settings API sample works but I'd like to use my own resources.
I tried your example and it doesn't work (on the current version of the simulator - 0.7.1.2):
import cat from '../resources/stat_hr_solid_16px.png';
<Section title="Import Image Example">
<TextImageRow
label="Example image - NOT WORKING"
icon={cat}
/>
<TextImageRow
label="Example WORKING WEB URL image (from docs sample)"
icon="<a href="https://tinyurl.com/ybbmpxxq" target="_blank">https://tinyurl.com/ybbmpxxq</a>"
/>
</Section>
Edit: typo fix.
Best Answer