Skip to content

Instantly share code, notes, and snippets.

@eaccmk
Last active September 12, 2021 10:20
Show Gist options
  • Save eaccmk/1222fb9c9eab831f7e8167457b7aeeb6 to your computer and use it in GitHub Desktop.
Save eaccmk/1222fb9c9eab831f7e8167457b7aeeb6 to your computer and use it in GitHub Desktop.
Fitbit app companion (mobile) setting to demo selecting a value with autocomplete text
// author : https://github.com/eaccmk
// created : sep-2021
function mySettings(props) {
return (
<Page>
<TextInput
title="Click me to type"
label="Type (one, two ...)"
placeholder="Type here"
action="Add Item"
onAutocomplete={(value) => {
const autoValues = [
{ name: "one", value: "1" },
{ name: "two", value: "2" },
{ name: "three", value: "3" },
{ name: "four", value: "4" },
{ name: "five", value: "5" },
{ name: "ten", value: "10" },
{ name: "one hundred", value: "100" },
];
return autoValues.filter((option) => option.name.startsWith(value));
}}
/>
</Page>
);
}
registerSettingsPage(mySettings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment