-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from blackshoe-esthete/EST-34-FE-login
[EST-34] Feat: 로그인 퍼블리싱, 소셜로그인 구현중
- Loading branch information
Showing
28 changed files
with
768 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic" | ||
"java.configuration.updateBuildConfiguration": "automatic", | ||
"java.compile.nullAnalysis.mode": "automatic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import {Dimensions, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; | ||
|
||
type genderProps = { | ||
title: string; | ||
onPress: () => void; | ||
value?: boolean; | ||
}; | ||
|
||
const windowWidth = Dimensions.get('window').width; | ||
|
||
function GenderButton(props: genderProps): React.JSX.Element { | ||
return ( | ||
<TouchableOpacity onPress={props.onPress}> | ||
<View style={[styles.buttonBox, {backgroundColor: props.value ? '#FFD600' : '#292929'}]}> | ||
<Text style={[styles.genderText, {color: props.value ? '#030303' : 'white'}]}>{props.title}</Text> | ||
</View> | ||
</TouchableOpacity> | ||
); | ||
} | ||
|
||
export default GenderButton; | ||
|
||
const styles = StyleSheet.create({ | ||
buttonBox: { | ||
width: (windowWidth - 60) / 2, | ||
height: 50, | ||
borderRadius: 8, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}, | ||
genderText: { | ||
fontSize: 14, | ||
fontWeight: '500', | ||
color: 'white', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import {StyleSheet, TextInput, View} from 'react-native'; | ||
|
||
type inputProp = { | ||
type?: | ||
| 'default' | ||
| 'email-address' | ||
| 'numeric' | ||
| 'phone-pad' | ||
| 'ascii-capable' | ||
| 'numbers-and-punctuation' | ||
| 'url' | ||
| 'number-pad' | ||
| 'name-phone-pad' | ||
| 'decimal-pad' | ||
| 'twitter' | ||
| 'web-search' | ||
| 'visible-password'; | ||
placeHolder: string; | ||
margin?: number; | ||
color?: string; | ||
security?: boolean; | ||
value?: string; | ||
onChange?: (text: string) => void; | ||
}; | ||
function InputText(props: inputProp): React.JSX.Element { | ||
return ( | ||
<TextInput | ||
placeholder={props.placeHolder} | ||
style={[styles.inputBox, {marginTop: props.margin, color: props.color || '#E9E9E9'}]} | ||
placeholderTextColor="#E9E9E9" | ||
value={props.value} | ||
keyboardType={props.type || 'default'} | ||
secureTextEntry={props.security} | ||
onChangeText={props.onChange} | ||
/> | ||
); | ||
} | ||
|
||
export default InputText; | ||
|
||
const styles = StyleSheet.create({ | ||
inputBox: { | ||
width: '100%', | ||
height: 70, | ||
backgroundColor: '#292929', | ||
borderRadius: 10, | ||
padding: 20, | ||
fontSize: 16, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { forwardRef, useState } from 'react'; | ||
import {Button, SafeAreaView} from 'react-native'; | ||
// import * as KakaoLogins from '@react-native-seoul/kakao-login'; | ||
import { login, logout, getProfile, KakaoOAuthToken, KakaoProfile, } from '@react-native-seoul/kakao-login'; | ||
|
||
// export const KakaoLogin = () => { | ||
// KakaoLogins | ||
// .login() | ||
// .then(result => { | ||
// console.log('Login Success', JSON.stringify(result)); | ||
// // getProfile(); | ||
// }) | ||
// .catch(error => { | ||
// if (error.code === 'E_CANCELLED_OPERATION') { | ||
// console.log('Login Cancel', error.message); | ||
// } else { | ||
// console.log(`Login Fail(code:${error.code})`, error.message); | ||
// } | ||
// }); | ||
// }; | ||
|
||
// const getProfile = () => { | ||
// KakaoLogins | ||
// .getProfile() | ||
// .then(result => { | ||
// console.log('GetProfile Success', JSON.stringify(result)); | ||
// }) | ||
// .catch(error => { | ||
// console.log(`GetProfile Fail(code:${error.code})`, error.message); | ||
// }); | ||
// }; | ||
|
||
|
||
export const KakaoLogin = () => { | ||
const [result, setResult] = useState(""); | ||
const signInWithKakao = async (): Promise<void> => { | ||
const token: KakaoOAuthToken = await login(); | ||
setResult(JSON.stringify(token)); | ||
}; | ||
const signOutWithKakao = async (): Promise<void> => { | ||
const message = await logout(); | ||
setResult(message); | ||
}; | ||
const getKakaoProfile = async (): Promise<void> => { | ||
const profile: KakaoProfile = await getProfile(); | ||
setResult(JSON.stringify(profile)); | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import {Dimensions, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; | ||
|
||
type buttonProp = { | ||
color: string; | ||
title: string; | ||
navigation: () => void; | ||
}; | ||
|
||
const windowWidth = Dimensions.get('window').width; | ||
|
||
function LoginButton(props: buttonProp): React.JSX.Element { | ||
return ( | ||
<TouchableOpacity onPress={() => props.navigation && props.navigation()}> | ||
<View style={[styles.button, {backgroundColor: props.color}]}> | ||
<Text style={styles.buttonTitle}>{props.title}</Text> | ||
</View> | ||
</TouchableOpacity> | ||
); | ||
} | ||
|
||
export default LoginButton; | ||
|
||
const styles = StyleSheet.create({ | ||
button: { | ||
borderRadius: 8, | ||
width: (windowWidth*9/10 - 20)/2, | ||
height: 50, | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center' | ||
}, | ||
buttonTitle: { | ||
color: 'white', | ||
fontFamily: "Gothic A1", | ||
fontSize: 16, | ||
fontWeight: '500', | ||
letterSpacing: -0.32 | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
import {Dimensions, Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; | ||
import naver from '@assets/imgs/naverlogin.png'; | ||
import * as KakaoLogin from '@react-native-seoul/kakao-login'; | ||
|
||
const windowWidth = Dimensions.get('window').width; | ||
type socialProp = { | ||
img: string; | ||
navigation?: () => void; | ||
}; | ||
function SocialLogin(props: socialProp): React.JSX.Element { | ||
// const login = () => { | ||
// KakaoLogin.login() | ||
// .then(result => { | ||
// console.log('Login Success', JSON.stringify(result)); | ||
// getProfile(); | ||
// }) | ||
// .catch(error => { | ||
// if (error.code === 'E_CANCELLED_OPERATION') { | ||
// console.log('Login Cancel', error.message); | ||
// } else { | ||
// console.log(`Login Fail(code:${error.code})`, error.message); | ||
// } | ||
// }); | ||
// }; | ||
|
||
const getKakaoIdToken = async (): Promise<KakaoLogin.KakaoOAuthToken> => { | ||
const res = await KakaoLogin.login(); | ||
console.log(res.accessToken); | ||
return res; | ||
}; | ||
const getProfile = () => { | ||
KakaoLogin.getProfile() | ||
.then(result => { | ||
console.log('GetProfile Success', JSON.stringify(result)); | ||
}) | ||
.catch(error => { | ||
console.log(`GetProfile Fail(code:${error.code})`, error.message); | ||
}); | ||
}; | ||
return ( | ||
<TouchableOpacity | ||
onPress={() => { | ||
getKakaoIdToken(); | ||
}}> | ||
<Image source={props.img} style={styles.buttonLayer} /> | ||
</TouchableOpacity> | ||
); | ||
} | ||
|
||
export default SocialLogin; | ||
|
||
const styles = StyleSheet.create({ | ||
buttonLayer: { | ||
width: (windowWidth * 9) / 10, | ||
borderRadius: 8, | ||
height: 57, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { View, Image, Text, StyleSheet } from "react-native"; | ||
import verified from '@assets/icons/verified.png'; | ||
import unverified from '@assets/icons/unverified.png'; | ||
|
||
type verifyProp = { | ||
label?: string; | ||
} | ||
|
||
function Verification(props: verifyProp):React.JSX.Element { | ||
return( | ||
<View style={styles.alertBox}> | ||
<Image source={unverified} style={styles.alertIcon} /> | ||
<Text style={styles.alertText}>인증번호가 불일치합니다.</Text> | ||
</View> | ||
); | ||
} | ||
|
||
export default Verification; | ||
|
||
const styles = StyleSheet.create({ | ||
alertBox: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
marginTop: 12, | ||
gap: 5, | ||
}, | ||
alertIcon: { | ||
width: 15, | ||
height: 15, | ||
}, | ||
alertText: { | ||
color: 'white', | ||
fontSize: 12, | ||
letterSpacing: -0.24, | ||
fontFamily: 'Gothic A1', | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.