Skip to content
Snippets Groups Projects
Commit 8325736c authored by Taneli Riihimäki's avatar Taneli Riihimäki
Browse files

Minor bugfixes, still need some fixin (if you change a game from the list...

Minor bugfixes, still need some fixin (if you change a game from the list while you are tracking, it will break)
parent dd567ded
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,8 @@ class GameList extends Component {
.then(response => response.json())
.then(games => {
this.setState({
games
games,
selectedGame: games[0]
});
})
.catch(error => {
......@@ -39,7 +40,11 @@ class GameList extends Component {
startTracking() {
this.intervalID = setInterval(() => {
console.log("Nyt träkätää nim birusti.");
console.log("Valittu peli: " + this.state.selectedGame);
console.log(
"Nyt träkätää nim birusti peliä: " + this.state.selectedGame.name
);
console.log("Tracking: " + this.state.tracking);
}, 3000);
}
......@@ -65,12 +70,13 @@ class GameList extends Component {
<Picker
style={styles.picker}
selectedValue={this.state.selectedGame}
onValueChange={(selectedGame, itemIndex) =>
this.setState({ selectedGame })
}
onValueChange={(selectedGame, itemIndex) => {
clearInterval(this.intervalID);
this.setState({ selectedGame, tracking: "false" });
}}
>
{this.state.games.map(game => (
<Picker.Item label={game.name} value={game.id} />
<Picker.Item label={game.name} value={game} />
))}
</Picker>
<LocationTracker
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment