Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-090 frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-090
2021-090 frontend
Commits
072bc4f4
Commit
072bc4f4
authored
Nov 09, 2021
by
IT18111170-Silva S.H.I
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: gamification model
parent
1ba2ca37
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
24 deletions
+49
-24
screen/gamification.js
screen/gamification.js
+49
-24
No files found.
screen/gamification.js
View file @
072bc4f4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// https://aboutreact.com/react-native-login-and-signup/
// https://aboutreact.com/react-native-login-and-signup/
// Import React and Component
// Import React and Component
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
import
{
StyleSheet
,
StyleSheet
,
View
,
View
,
...
@@ -21,7 +21,28 @@ import axios from "axios";
...
@@ -21,7 +21,28 @@ import axios from "axios";
export
function
gamification
({
navigation
})
{
export
function
gamification
({
navigation
})
{
// const [title, setTitle] = useState();
// const [title, setTitle] = useState();
const
[
earn
,
setEarn
]
=
useState
(
""
);
const
fetchData
=
async
()
=>
{
// const resp = await fetch("http://192.168.8.126:5000/getDetails", {method:"POST"});
axios
({
method
:
"
GET
"
,
url
:
"
http://192.168.8.126:5000/getVal/<id>
"
,
})
.
then
(
function
(
response
)
{
console
.
log
(
response
.
data
.
message
);
// data = response.data
setEarn
(
response
.
data
.
message
);
})
.
catch
(
function
(
error
)
{
console
.
log
(
"
axios error
"
+
error
);
});
};
useEffect
(()
=>
{
fetchData
();
},[]);
// const handlecarrot = () => {
// const handlecarrot = () => {
// setTitle({title: "carrot"});
// setTitle({title: "carrot"});
// console.log(title)
// console.log(title)
...
@@ -101,9 +122,9 @@ export function gamification({ navigation }) {
...
@@ -101,9 +122,9 @@ export function gamification({ navigation }) {
<
TouchableOpacity
<
TouchableOpacity
style
=
{
styles
.
buttonSub
}
style
=
{
styles
.
buttonSub
}
title
=
"
carrot
"
title
=
"
carrot
"
onPress
=
{(
title
)
=>
{
onPress
=
{(
title
)
=>
{
props
.
setFieldValue
(
'
title
'
,
"
carrot
"
)
props
.
setFieldValue
(
"
title
"
,
"
carrot
"
);
props
.
handleSubmit
(
title
)
props
.
handleSubmit
(
title
);
}}
}}
// onPress={handlecarrot}
// onPress={handlecarrot}
>
>
...
@@ -113,9 +134,9 @@ export function gamification({ navigation }) {
...
@@ -113,9 +134,9 @@ export function gamification({ navigation }) {
<
TouchableOpacity
<
TouchableOpacity
style
=
{
styles
.
buttonSub
}
style
=
{
styles
.
buttonSub
}
title
=
"
tomato
"
title
=
"
tomato
"
onPress
=
{(
title
)
=>
{
onPress
=
{(
title
)
=>
{
props
.
setFieldValue
(
'
title
'
,
"
tomato
"
)
props
.
setFieldValue
(
"
title
"
,
"
tomato
"
);
props
.
handleSubmit
(
title
)
props
.
handleSubmit
(
title
);
}}
}}
>
>
<
Text
style
=
{
styles
.
buttonText
}
>
Tomato
<
/Text
>
<
Text
style
=
{
styles
.
buttonText
}
>
Tomato
<
/Text
>
...
@@ -124,9 +145,9 @@ export function gamification({ navigation }) {
...
@@ -124,9 +145,9 @@ export function gamification({ navigation }) {
<
TouchableOpacity
<
TouchableOpacity
style
=
{
styles
.
buttonSub
}
style
=
{
styles
.
buttonSub
}
title
=
"
chilli
"
title
=
"
chilli
"
onPress
=
{(
title
)
=>
{
onPress
=
{(
title
)
=>
{
props
.
setFieldValue
(
'
title
'
,
"
chilli
"
)
props
.
setFieldValue
(
"
title
"
,
"
chilli
"
);
props
.
handleSubmit
(
title
)
props
.
handleSubmit
(
title
);
}}
}}
>
>
<
Text
style
=
{
styles
.
buttonText
}
>
chilli
<
/Text
>
<
Text
style
=
{
styles
.
buttonText
}
>
chilli
<
/Text
>
...
@@ -135,9 +156,9 @@ export function gamification({ navigation }) {
...
@@ -135,9 +156,9 @@ export function gamification({ navigation }) {
<
TouchableOpacity
<
TouchableOpacity
style
=
{
styles
.
buttonSub
}
style
=
{
styles
.
buttonSub
}
title
=
"
beans
"
title
=
"
beans
"
onPress
=
{(
title
)
=>
{
onPress
=
{(
title
)
=>
{
props
.
setFieldValue
(
'
title
'
,
"
beans
"
)
props
.
setFieldValue
(
"
title
"
,
"
beans
"
);
props
.
handleSubmit
(
title
)
props
.
handleSubmit
(
title
);
}}
}}
>
>
<
Text
style
=
{
styles
.
buttonText
}
>
Beans
<
/Text
>
<
Text
style
=
{
styles
.
buttonText
}
>
Beans
<
/Text
>
...
@@ -150,9 +171,13 @@ export function gamification({ navigation }) {
...
@@ -150,9 +171,13 @@ export function gamification({ navigation }) {
marginTop
:
10
,
marginTop
:
10
,
}}
}}
>
>
<
FontAwesome
name
=
"
money
"
size
=
{
50
}
color
=
"
black
"
/>
<
FontAwesome
name
=
"
money
"
size
=
{
50
}
color
=
"
black
"
style
=
{{
alignSelf
:
"
center
"
,
}}
/
>
<
Text
style
=
{
styles
.
textdata
}
>
TOTAL
EARNED
$
:
{
earn
}
<
/Text
>
<
/View
>
<
/View
>
<
Text
style
=
{
styles
.
textdata
}
>
TOTAL
EARNED
$
:
1000
<
/Text
>
<
/View
>
<
/View
>
)}
)}
<
/Formik
>
<
/Formik
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment