Last active
September 12, 2021 10:20
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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