I’m looking for a minimum viable code example using a TextField UI Extension in a POS modal. Right now whatever text I type into the field gets immediately removed. The documentation is here but does not include an example.
Here’s what I have so far, it renders the text box as expected but typing into it is fruitless, it does not change the value persistently.
const company = {val: ''};
function handleCompany(val) {
company.val = val
}
function getCompany() {
return company.val
}
companyText = root.createComponent(TextField, {label: 'Company', required: true, disabled: false, value: getCompany(), onChange: val => {handleCompany(val)}})
screen.appendChild(companyText)