05-19-2018 19:16
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
05-19-2018 19:16
It seems to me that mixed-text components calculate their layout (ie, element sizes and positions) when first instantiated in .gui, but not dynamically in response to changes made via .js. For example, if a mixed-text is initialised in .gui with #copy/text that takes one line to display, changing the text in .js to a longer string will only display the topmost line of the new text. This is independent of the buffer-length value.
The reverse situation also applies: if the component is initialised with a long string which is subsequently replaced with a short one, the component leaves unnecessary blank space.
This makes it difficult to use a mixed-text to make a reusable popup dialog box.
If I'm right about this, could mixed-text please be modified to update its layout whenever any relevant attributes are changed?
06-01-2018 12:00
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.
06-01-2018 12:00
You could try sending one of the events after changing the text.
One of these might work:
yourelement.sendEvent({ type: 'EVENT_NAME' });
yourelement.animate('EVENT_NAME');
yourelement.state = "EVENT_NAME";
Here's the list of event names: EVENT_NAME
activate, click, collapse, disable, enable, expand, highlight, load, mousedown, mousemove, mouseout, mouseover, mouseup, paint, reload, select, unhighlight, unload, and unselect
06-01-2018 17:18
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
06-01-2018 17:18
Welcome back, Jon!
Thanks for the suggestion. I tried all of those events on both the mixed-text and copy/text elements, but nothing triggered a re-layout.
Here's an example of what happens if the copy/text is changed from a one-liner to a longer string (the full sentence):
Here's what it should look like (and DOES look like if the .gui string is three lines long):
I feel that setting the copy/text.text in javascript should automatically trigger a re-layout.
06-27-2018 00:55
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
06-27-2018 00:55
A little more info on this bug: the layout IS recalculated whenever the display comes back on. As a result, the layout can vary before and after the display cycling, leading to bizarre inconsistencies—all without the execution of any app code.
This was a major pain to fault-find!
Since it's obviously possible for mixed-text components to recalculate their layouts after javascript-based changes, could I urge that this be done whenever the content changes rather than just whenever the display comes on.
07-18-2022 17:21
07-18-2022 17:21
Since the post is more than four years old I wonder if the issue still hasn't been fixed?
I am developing on a Fitbit Sense using the SDK 6.1.0 and following https://dev.fitbit.com/build/guides/user-interface/svg/#dynamic-textarea
I have still have the same problem that the textarea is NOT resized after changing its text from JS.
Is there a workaround?