Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Telemedicine_App_Development
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
Shashini Thilakarathne
Telemedicine_App_Development
Commits
dfb49044
Commit
dfb49044
authored
Mar 17, 2024
by
Shashini Thilakarathne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Popup Form
parent
293360a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
28 deletions
+79
-28
StressPrediction/src/newJournalEntry.js
StressPrediction/src/newJournalEntry.js
+79
-28
No files found.
StressPrediction/src/newJournalEntry.js
View file @
dfb49044
import
{
View
,
Text
,
StyleSheet
,
TextInput
,
Button
,
Image
}
from
'
react-native
'
import
{
View
,
Text
,
StyleSheet
,
TextInput
,
Button
,
Image
,
Modal
,
TouchableOpacity
}
from
'
react-native
'
import
React
,
{
useState
}
from
'
react
'
import
{
db
}
from
'
../config
'
import
{
ref
,
set
}
from
'
firebase/database
'
...
...
@@ -7,6 +7,7 @@ const AddData = () => {
const
[
Job_Satisfaction
,
setTitle
]
=
useState
(
''
);
const
[
Sleep_Hours
,
setSleepHours
]
=
useState
(
''
);
const
[
Additional_Text
,
setText
]
=
useState
(
''
);
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
// function to update data in Firebase Realtime DB
const
updateData
=
()
=>
{
...
...
@@ -24,15 +25,35 @@ const AddData = () => {
}
else
{
console
.
error
(
"
Invalid input for Job Satisfaction or Sleep Hours. Please enter valid numbers.
"
);
}
setModalVisible
(
false
);
// Close the modal after updating data
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
header
}
>
STRESS
TRACKER
<
/Text
>
<
TouchableOpacity
onPress
=
{()
=>
setModalVisible
(
true
)}
>
<
Image
source
=
{
require
(
'
../images/Home.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
/TouchableOpacity
>
<
Button
title
=
"
Open Popup
"
onPress
=
{()
=>
setModalVisible
(
true
)}
/
>
<
Modal
animationType
=
"
slide
"
transparent
=
{
true
}
visible
=
{
modalVisible
}
onRequestClose
=
{()
=>
{
setModalVisible
(
!
modalVisible
);
}}
>
<
View
style
=
{
styles
.
modalContainer
}
>
<
View
style
=
{
styles
.
modalContent
}
>
<
TouchableOpacity
onPress
=
{()
=>
setModalVisible
(
false
)}
style
=
{
styles
.
closeButton
}
>
<
Text
style
=
{
styles
.
closeButtonText
}
>
X
<
/Text
>
<
/TouchableOpacity
>
<
TextInput
placeholder
=
'
Job Satisfaction
'
value
=
{
Job_Satisfaction
}
...
...
@@ -58,6 +79,9 @@ const AddData = () => {
onPress
=
{
updateData
}
/
>
<
/View
>
<
/View
>
<
/Modal
>
<
/View
>
)
}
...
...
@@ -86,5 +110,32 @@ const styles = StyleSheet.create({
image
:
{
width
:
'
100%
'
,
height
:
200
,
}
},
modalContainer
:
{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
backgroundColor
:
'
rgba(0, 0, 0, 0.5)
'
,
},
modalContent
:
{
backgroundColor
:
'
#fff
'
,
padding
:
20
,
borderRadius
:
10
,
width
:
'
80%
'
,
},
closeButton
:
{
position
:
'
absolute
'
,
top
:
10
,
right
:
10
,
backgroundColor
:
'
#ccc
'
,
borderRadius
:
15
,
width
:
30
,
height
:
30
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
closeButtonText
:
{
fontSize
:
20
,
fontWeight
:
'
bold
'
,
},
});
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