Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ehasa-mobile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WIMMA Lab 2019
Overflow
ehasa-mobile
Commits
49a686ac
Commit
49a686ac
authored
5 years ago
by
Taneli Riihimäki
Browse files
Options
Downloads
Patches
Plain Diff
Tracking should work, need to implement endtoend
parent
52076b6a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
App.js
+1
-2
1 addition, 2 deletions
App.js
components/GameList.js
+67
-10
67 additions, 10 deletions
components/GameList.js
components/LocationTracker.js
+27
-0
27 additions, 0 deletions
components/LocationTracker.js
with
95 additions
and
12 deletions
App.js
+
1
−
2
View file @
49a686ac
...
...
@@ -6,8 +6,7 @@ import Login from "./components/Login";
export
default
class
App
extends
React
.
Component
{
state
=
{
userLocation
:
null
,
usersHistory
:
[]
userLocation
:
null
};
userTrackingHandler
=
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
components/GameList.js
+
67
−
10
View file @
49a686ac
import
React
,
{
Component
,
Fragment
}
from
"
react
"
;
import
{
FlatList
,
Button
}
from
"
react-native
"
;
import
{
FlatList
,
Button
,
Picker
,
Text
,
StyleSheet
}
from
"
react-native
"
;
import
LocationTracker
from
"
./LocationTracker
"
;
class
GameList
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
games
:
[],
tracking
:
false
,
selectedGame
:
null
,
editForm
:
false
};
intervalID
=
0
;
}
componentDidMount
()
{
...
...
@@ -28,17 +33,69 @@ class GameList extends Component {
});
}
handleTrackingChange
()
{
this
.
setState
({
tracking
:
!
this
.
state
.
tracking
});
}
startTracking
()
{
this
.
intervalID
=
setInterval
(()
=>
{
console
.
log
(
"
Nyt träkätää nim birusti.
"
);
},
3000
);
}
stopTracking
()
{
clearInterval
(
this
.
intervalID
);
console
.
log
(
"
Nyt lopetetaa seuranta.
"
);
}
componentDidUpdate
()
{
if
(
this
.
state
.
tracking
)
{
this
.
startTracking
();
}
else
if
(
!
this
.
state
.
tracking
)
{
this
.
stopTracking
();
}
}
componentWillUnmount
()
{
clearInterval
(
this
.
intervalID
);
}
render
()
{
return
(
<
Fragment
>
{
this
.
state
.
games
.
length
>
0
&&
(
<
FlatList
data
=
{
this
.
state
.
games
}
renderItem
=
{({
item
})
=>
<
Button
title
=
{
item
.
name
}
/>
}
if
(
this
.
state
.
games
.
length
>
0
)
{
const
items
=
(
<
Fragment
>
<
Picker
style
=
{
styles
.
picker
}
selectedValue
=
{
this
.
state
.
selectedGame
}
onValueChange
=
{(
selectedGame
,
itemIndex
)
=>
this
.
setState
({
selectedGame
})
}
>
{
this
.
state
.
games
.
map
(
game
=>
(
<
Picker
.
Item
label
=
{
game
.
name
}
value
=
{
game
.
id
}
/
>
))}
<
/Picker
>
<
LocationTracker
tracking
=
{
this
.
state
.
tracking
}
handleTrackingChange
=
{
this
.
handleTrackingChange
.
bind
(
this
)}
/
>
)}
<
/Fragment
>
);
<
/Fragment
>
);
return
<
Fragment
>
{
items
}
<
/Fragment>
;
}
else
return
null
;
}
}
const
styles
=
StyleSheet
.
create
({
picker
:
{
width
:
200
,
height
:
100
}
});
export
default
GameList
;
// {this.state.games.length > 0 && (
// <FlatList
// data={this.state.games}
// renderItem={({ item }) => <Button title={item.name} />}
// />
// )}
This diff is collapsed.
Click to expand it.
components/LocationTracker.js
0 → 100644
+
27
−
0
View file @
49a686ac
import
React
,
{
Fragment
}
from
"
react
"
;
import
{
Switch
,
Text
,
StyleSheet
}
from
"
react-native
"
;
const
LocationTracker
=
props
=>
{
return
(
<
Fragment
>
<
Text
style
=
{
styles
.
titleText
}
>
Tracking
:
<
/Text
>
<
Switch
style
=
{
styles
.
switch
}
value
=
{
props
.
tracking
}
onValueChange
=
{
props
.
handleTrackingChange
}
/
>
<
/Fragment
>
);
};
const
styles
=
StyleSheet
.
create
({
switch
:
{},
titleText
:
{
fontSize
:
40
,
fontWeight
:
"
bold
"
,
textAlign
:
"
center
"
,
textAlignVertical
:
"
center
"
}
});
export
default
LocationTracker
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment