Created
September 30, 2018 14:42
Settings page more or less exactly like the BART example
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
function mySettings(props) { | |
return ( | |
<Page> | |
<Section title={<Text bold align="center"> Schedule </Text>}> | |
<AdditiveList | |
title="Select your favorite stations" | |
settingsKey="favorite_station_setting" | |
maxItems="10" | |
addAction={ | |
quayPicker(props) | |
} | |
/> | |
</Section> | |
</Page> | |
); | |
} | |
function quayPicker(props) { | |
return ( | |
<Section> | |
<TextInput | |
title="Add a Bart Station" | |
label="Name" | |
placeholder="Type something" | |
action="Add Station" | |
onChange={(value) => {}} //XXX Can i do something here | |
onAutocomplete={(value) => { | |
return getAutoQuay(value).then(function(quayData) { | |
//XXX quayData is a list of matching stations | |
//XXX Can i do something here to return a new list that can be rendered instead of data? | |
//XXX | |
return quayData; | |
}).catch(function(error) { | |
console.log('mySettings: error'); console.log(e); | |
} | |
}); | |
}} | |
/> | |
</Section> | |
); | |
} | |
registerSettingsPage(mySettings); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment