Last active
September 12, 2021 10:19
-
-
Save eaccmk/b2c994cb514c275cf76eb02f2a294238 to your computer and use it in GitHub Desktop.
Fitbit app companion (mobile) setting to demo how to select multiple item from a list
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> | |
<AdditiveList | |
title="Items with Autocomplete feature" | |
settingsKey="autocomplete-list" | |
maxItems="3" | |
addAction={ | |
<TextInput | |
title="Add your Item" | |
label="Item Name" | |
placeholder="Type here (one, two...)" | |
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