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
ec77a636
Commit
ec77a636
authored
Mar 14, 2024
by
Shashini Thilakarathne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SetUp Firebase Database
parent
059e5ab3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
7 deletions
+88
-7
StressPrediction/App.js
StressPrediction/App.js
+3
-7
StressPrediction/config.js
StressPrediction/config.js
+21
-0
StressPrediction/src/index.js
StressPrediction/src/index.js
+64
-0
No files found.
StressPrediction/App.js
View file @
ec77a636
import
{
St
atusBar
}
from
'
expo-status-bar
'
;
import
{
St
yleSheet
,
View
}
from
'
react-native
'
;
import
{
StyleSheet
,
Text
,
View
}
from
'
react-native
'
;
import
AddData
from
'
./src
'
;
export
default
function
App
()
{
export
default
function
App
()
{
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
Text
>
Open
up
App
.
js
to
start
working
on
your
app
!<
/Text
>
<
AddData
/>
<
StatusBar
style
=
"
auto
"
/>
<
/View
>
<
/View
>
);
);
}
}
...
@@ -13,8 +12,5 @@ export default function App() {
...
@@ -13,8 +12,5 @@ export default function App() {
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
flex
:
1
,
flex
:
1
,
backgroundColor
:
'
#fff
'
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
,
},
},
});
});
StressPrediction/config.js
0 → 100644
View file @
ec77a636
import
firebase
from
'
firebase/compat/app
'
;
import
{
getDatabase
}
from
'
firebase/database
'
;
const
firebaseConfig
=
{
apiKey
:
"
AIzaSyCGepr7j41wWYOcq2KgfT2TU9U7ye723Ko
"
,
authDomain
:
"
researchproject-ded92.firebaseapp.com
"
,
databaseURL
:
"
https://researchproject-ded92-default-rtdb.asia-southeast1.firebasedatabase.app
"
,
projectId
:
"
researchproject-ded92
"
,
storageBucket
:
"
researchproject-ded92.appspot.com
"
,
messagingSenderId
:
"
315494030749
"
,
appId
:
"
1:315494030749:web:4f25e1e9f44228e2b02374
"
,
measurementId
:
"
G-52Y793E4LV
"
}
if
(
firebase
.
apps
.
length
===
0
){
firebase
.
initializeApp
(
firebaseConfig
);
}
const
db
=
getDatabase
();
export
{
db
};
StressPrediction/src/index.js
0 → 100644
View file @
ec77a636
import
{
View
,
Text
,
StyleSheet
,
TextInput
,
Button
}
from
'
react-native
'
import
React
,
{
useState
}
from
'
react
'
import
{
db
}
from
'
../config
'
import
{
ref
,
set
}
from
'
firebase/database
'
const
AddData
=
()
=>
{
const
[
title
,
setTitle
]
=
useState
(
''
);
const
[
body
,
setBody
]
=
useState
(
''
);
//function to add data to forebase realtime db
const
dataAddOn
=
()
=>
{
set
(
ref
(
db
,
'
posts/
'
+
title
),{
title
:
title
,
body
:
body
,
});
setTitle
(
''
)
setBody
(
''
)
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
header
}
>
AddData
<
/Text
>
<
TextInput
placeholder
=
'
Title
'
value
=
{
title
}
onChangeText
=
{(
text
)
=>
setTitle
(
text
)}
style
=
{
styles
.
input
}
/
>
<
TextInput
placeholder
=
'
Body
'
value
=
{
body
}
onChangeText
=
{(
text
)
=>
setBody
(
text
)}
style
=
{
styles
.
input
}
/
>
<
Button
title
=
'
Add Data
'
onPress
=
{
dataAddOn
}
/
>
<
/View
>
)
}
export
default
AddData
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
backgroundColor
:
'
#fff
'
,
},
header
:{
fontSize
:
30
,
textAlign
:
'
center
'
,
marginTop
:
100
,
fontWeight
:
'
bold
'
},
input
:{
borderWidth
:
1
,
borderColor
:
'
black
'
,
margin
:
10
,
padding
:
10
,
fontSize
:
18
,
borderRadius
:
6
,
}
});
\ No newline at end of file
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