import { Pressable, StyleSheet, Text, View } from 'react-native'; import React, { useState } from 'react'; import { login, logout, getProfile as getKakaoProfile, unlink } from '@react-native-seoul/kakao-login'; import ResultView from './IntroView'; const Intro = () => { const [result, setResult] = useState(''); const signInWithKakao = async (): Promise => { try { const token = await login(); setResult(JSON.stringify(token)); } catch (err) { console.error('login err', err); } }; const signOutWithKakao = async (): Promise => { try { const message = await logout(); setResult(message); } catch (err) { console.error('signOut error', err); } }; const getProfile = async (): Promise => { try { const profile = await getKakaoProfile(); setResult(JSON.stringify(profile)); } catch (err) { console.error('signOut error', err); } }; const unlinkKakao = async (): Promise => { try { const message = await unlink(); setResult(message); } catch (err) { console.error('signOut error', err); } }; return ( { signInWithKakao(); }} > 카카오 로그인 getProfile()} > 프로필 조회 unlinkKakao()} > 링크 해제 signOutWithKakao()} > 카카오 로그아웃 ); }; export default Intro; const styles = StyleSheet.create({ container: { height: "100%", justifyContent: "flex-end", alignItems: 'center', paddingBottom: 100 }, button: { backgroundColor: '#FEE500', borderRadius: 40, borderWidth: 1, width: 250, height: 40, paddingHorizontal: 20, paddingVertical: 10, marginTop: 10 }, text: { textAlign: "center" } });