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

some textinputs in settings not showing in index.gui

ANSWERED

I'm working on an app that has several textinput fields in the setttings.jsx file and uses scrollview to display the text in index.gui. My problem is I can't start by entering a random field, say the fourth textinput field, as it will not display on watch, unless I enter items from the first textinput and onward to the fourth. The only solution I have found is to go to each and every textinput field and tap "save". That seems to initiate each field and I can then enter something in any random field and it displays fine. Is there anyway I can somehow avoid the need to tap save on every field?

Thanks from a newbie.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

solved the problem. It wasn't in the settings or svg files, but in the main index file. The JSONstringify function was failing when the object was null, and exiting the apply settings function. I solved it by testing if the settings object was not equal to null.

View best answer in original post

Best Answer
0 Votes
5 REPLIES 5

Can you provide an example of your settings JSX file, thanks

Best Answer
0 Votes

OK here is part of it:

 

function mySettings(props) {
return (
<Page>

<Section
title={<Text bold align="center">Personal ID:</Text>}>
<TextInput
label="Name:"
settingsKey="myname"

/>
<TextInput
label="Birth Date:"
settingsKey="bdate"
/>

<TextInput
label="Insurance No./Provider:"
settingsKey="insurance"
placeholder="PHN# or provider"
/>
</Section>
<Section
title={<Text bold align="center">Emergency Contacts:</Text>}>
<TextInput
label="Emergency Contact 1:"
settingsKey="emerg1"
placeholder="enter name here"

/> <TextInput
label="Contact 2 Phone No.:"
settingsKey="phone2"
placeholder="enter phone number here"

/>
</Section>
<Section
title={<Text bold align="center">Doctors:</Text>}>
<TextInput
label="Doctor1:"
settingsKey="doc1"
placeholder="enter name and city"
/>
<TextInput
label="Doctor2:"
settingsKey="doc2"
placeholder="enter name and city"
/>
</Section>
</Page>
);
}

registerSettingsPage(mySettings);

Best Answer
0 Votes

I think I found the problem. When I use scrollview in the index.gui, like someone on this forum suggested, using only two scrollview items with one being high enough to contain all the text elements, it displays the way I want, by not inserting blank lines if no text is present. It make a neat looking interface. But, if I don't initialize each textinput from the beginning on in settings jsx, it won't update and display a textinput further down the list.

If I use scrollview as suggested in the guides, by using one scrollview item for each text input, they will update correctly even if a textinput further down the list is entered, but the display shows blank lines for every item, and that makes a messy display with lots of blanks if there are many blank textinputs. I cant seem to find a solution. 

Best Answer
0 Votes

solved the problem. It wasn't in the settings or svg files, but in the main index file. The JSONstringify function was failing when the object was null, and exiting the apply settings function. I solved it by testing if the settings object was not equal to null.

Best Answer
0 Votes

How did you do it? Can you give me some help, as using JSON.parse(thing.name) doesn't work for TextInput

Currently TextInput (JSX) is still bugged (the name field appears if the USER changes it in the settingsKey). However if the code uses settingStorage.setItem, the name field disappears and the output is as neat as it should have

Best Answer
0 Votes