Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FOSS2023-1_final
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
우상현
FOSS2023-1_final
Commits
cb18c9bb
Commit
cb18c9bb
authored
1 year ago
by
wooshanghyeon
Browse files
Options
Downloads
Patches
Plain Diff
Complete examples signUp&In , data CRUD
parent
1a4e2d77
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
AwesomeProject/App.js
+65
-8
65 additions, 8 deletions
AwesomeProject/App.js
AwesomeProject/android/app/src/main/AndroidManifest.xml
+1
-1
1 addition, 1 deletion
AwesomeProject/android/app/src/main/AndroidManifest.xml
with
66 additions
and
9 deletions
AwesomeProject/App.js
+
65
−
8
View file @
cb18c9bb
...
...
@@ -3,32 +3,59 @@ import React, {useState} from 'react';
import
{
Text
,
TextInput
,
TouchableOpacity
,
View
}
from
'
react-native
'
;
import
{
signIn
,
signUp
}
from
'
./lib/auth
'
;
import
{
Alert
}
from
'
react-native
'
;
import
{
createUser
}
from
'
./lib/user
'
;
import
firestore
from
'
@react-native-firebase/firestore
'
;
import
{
firebase
}
from
'
@react-native-firebase/auth
'
;
const
App
=
()
=>
{
const
[
email
,
setEmail
]
=
useState
();
const
[
password
,
setPass
]
=
useState
();
const
[
displayName
,
setName
]
=
useState
();
const
onSignUp
=
async
()
=>
{
console
.
log
(
email
,
password
);
try
{
const
{
user
}
=
await
signUp
({
email
,
password
});
console
.
log
(
user
);
await
createUser
({
id
:
user
.
uid
,
displayName
,
photoURL
:
null
,
});
Alert
.
alert
(
'
회원가입 성공!
'
);
}
catch
(
e
)
{
console
.
log
(
e
);
Alert
.
alert
(
'
회원가입 실패ㅠㅠ
'
);
}
setEmail
();
setPass
();
setName
();
};
const
onSignIn
=
async
()
=>
{
console
.
log
(
email
,
password
);
try
{
const
{
user
}
=
await
signIn
({
email
,
password
});
console
.
log
(
user
);
Alert
.
alert
(
'
로그인 성공!.
'
);
const
userCollection
=
firestore
().
collection
(
'
users
'
);
console
.
log
(
await
userCollection
.
doc
(
user
.
uid
).
get
());
await
userCollection
.
doc
(
user
.
uid
).
update
({
displayName
});
console
.
log
(
await
userCollection
.
doc
(
user
.
uid
).
get
());
Alert
.
alert
(
'
로그인 성공!
'
);
}
catch
(
e
)
{
Alert
.
alert
(
'
로그인에 실패ㅠㅠ
'
);
}
setEmail
();
setPass
();
setName
();
};
const
onDelete
=
async
()
=>
{
// try {
// const {user} = await signIn({email, password});
// const userCollection = firestore().collection('users');
// await userCollection.doc(user.uid).delete();
// Alert.alert('데이터베이스 삭제 tㅠㅠ');
// } catch (e) {
// Alert.alert('데이터베이스 삭제 실패ㅠㅠ');
// }
// const {user} = await signIn({email, password});
// user.delete().catch(e => {
// console.log(e);
// });
};
return
(
<
View
>
<
Text
style
=
{{
fontSize
:
20
,
fontWeight
:
'
bold
'
}}
>
회원가입
예시
<
/Text
>
...
...
@@ -45,6 +72,12 @@ const App = () => {
placeholderTextColor
=
{
'
black
'
}
style
=
{{
borderColor
:
'
red
'
,
borderBottomWidth
:
1
}}
/
>
<
TextInput
onChangeText
=
{
setName
}
placeholder
=
"
displayName
"
placeholderTextColor
=
{
'
black
'
}
style
=
{{
borderColor
:
'
red
'
,
borderBottomWidth
:
1
}}
/
>
<
TouchableOpacity
onPress
=
{
onSignUp
}
>
<
Text
>
SignUp
<
/Text
>
<
/TouchableOpacity
>
...
...
@@ -63,10 +96,34 @@ const App = () => {
placeholderTextColor
=
{
'
black
'
}
style
=
{{
borderColor
:
'
red
'
,
borderBottomWidth
:
1
}}
/
>
<
TextInput
onChangeText
=
{
setName
}
placeholder
=
"
displayName
"
placeholderTextColor
=
{
'
black
'
}
style
=
{{
borderColor
:
'
red
'
,
borderBottomWidth
:
1
}}
/
>
<
TouchableOpacity
onPress
=
{
onSignIn
}
>
<
Text
>
Login
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
Text
style
=
{{
fontSize
:
20
,
fontWeight
:
'
bold
'
}}
>
삭제
예시
<
/Text
>
<
View
style
=
{{
borderWidth
:
3
}}
>
<
TextInput
onChangeText
=
{
setEmail
}
placeholder
=
"
email
"
placeholderTextColor
=
{
'
black
'
}
style
=
{{
borderColor
:
'
red
'
,
borderBottomWidth
:
1
}}
/
>
<
TextInput
onChangeText
=
{
setPass
}
placeholder
=
"
password
"
placeholderTextColor
=
{
'
black
'
}
style
=
{{
borderColor
:
'
red
'
,
borderBottomWidth
:
1
}}
/
>
<
TouchableOpacity
onPress
=
{
onDelete
}
>
<
Text
>
delete
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
};
...
...
This diff is collapsed.
Click to expand it.
AwesomeProject/android/app/src/main/AndroidManifest.xml
+
1
−
1
View file @
cb18c9bb
...
...
@@ -15,7 +15,7 @@
android:label=
"@string/app_name"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode=
"singleTask"
android:windowSoftInputMode=
"adjust
Resize
"
android:windowSoftInputMode=
"adjust
Pan
"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
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