Skip to content

Commit

Permalink
[Feat] HomePage 폴더 Image 수정 및 임시 폴더 추가 기능
Browse files Browse the repository at this point in the history
  • Loading branch information
zxl3651 committed Jun 3, 2023
1 parent b406548 commit 0631783
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Components/GoogleLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ const styles = StyleSheet.create({
width: width,
marginLeft: 15,
marginTop: 180,
resizeMode: "contain",
resizeMode: "contain",
}
});
6 changes: 0 additions & 6 deletions src/Components/NaverLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export default function NaverLogin({ navigation }) {
if (result.type === "success") {
const code = result.params.code;
state_value = result.params.state;
console.log(result);
console.log(code);
//mutate({
// id_token: code,
// provider: "NAVER",
Expand All @@ -42,7 +40,6 @@ export default function NaverLogin({ navigation }) {
const requestToken = async (request_code) => {
var Access_Token = "none";
var request_token_url = `https://nid.naver.com/oauth2.0/token?`;
console.log("두 번째 함수 시작");
axios({
methos: "post",
url: request_token_url,
Expand All @@ -55,7 +52,6 @@ export default function NaverLogin({ navigation }) {
},
})
.then(function (response) {
console.log("토큰 받기 함수 결과: ", response);
Access_Token = response.data.access_token;
//console.log(Access_Token);
requestUserInfo(Access_Token);
Expand All @@ -66,7 +62,6 @@ export default function NaverLogin({ navigation }) {
};

const requestUserInfo = async (Access_Token) => {
console.log("세 번쨰 함수 시작");
axios({
method: "GET",
url: "https://openapi.naver.com/v1/nid/me",
Expand All @@ -75,7 +70,6 @@ export default function NaverLogin({ navigation }) {
},
})
.then(async (response) => {
console.log("회원 프로필 조회 결과: ", response);
await AsyncStorage.setItem(
STORAGE_KEY,
JSON.stringify(response.data.response.id)
Expand Down
16 changes: 16 additions & 0 deletions src/Data/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { useState } from "react"

export const folders = [
{
id: 1, //각 폴더의 고유 id값
text: "20230531", //각 폴더의 제목 string값
},
{
id: 2,
text: "20230602",
},
{
id: 3,
text: "20230605",
},
]
48 changes: 23 additions & 25 deletions src/Screen/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ import {
ScrollView,
TextInput,
FlatList,
Dimensions
} from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Fontisto, AntDesign } from "@expo/vector-icons";

import { folders } from "../Data/data";

const { height, width } = Dimensions.get("window");

function Home({ navigation }) {
// 폰트 로드
const [isReady, setIsReady] = useState(false);
Expand All @@ -31,29 +36,22 @@ function Home({ navigation }) {
loadFonts();
}, []);

//--------------------------------------------------------------------------
// Flatlist 정상 작동되는지 확인용 코드
const [folder, setFolder] = useState(folders)
const [id_num, setId_num] = useState(4)

function update_Folder(){
const newfolder = {
id: id_num,
text: "20230707202020",
}
setFolder([...folder, newfolder])
setId_num(id_num + 1)
}
console.log(folder);
//--------------------------------------------------------------------------

const folders = [
{
id: "1", //각 폴더의 고유 id값
text: "20230531", //각 폴더의 제목 string값
},
{
id: "2",
text: "20230602",
},
{
id: "3",
text: "20230605",
},
{
id: "4",
text: "20230605",
},
{
id: "5",
text: "20230605",
},
]
const folder_components = ({ item }) => (
<View
style={{
Expand All @@ -65,7 +63,7 @@ function Home({ navigation }) {
<TouchableOpacity>
<View style={{ justifyContent: "center", alignItems: "center" }}>
<Image source={require("../../assets/folder_image.png")} />
<View style={{ width: 60 }}>
<View style={{ width: width / 4, height: height / 64}}>
<Text style={{ textAlign: "center" }}>{item.text} </Text>
</View>
</View>
Expand All @@ -79,12 +77,12 @@ function Home({ navigation }) {
<View>
<View style = {{flexDirection: "row", justifyContent: "space-between"}}>
<Text style = {styles.text_style}>📖오답노트📖</Text>
<TouchableOpacity>
<TouchableOpacity onPress={update_Folder}>
<Text style={styles.text_style}>폴더 추가하기</Text>
</TouchableOpacity>
</View>
<FlatList
data = {folders}
data = {folder}
renderItem={folder_components}
numColumns={2}
keyExtractor={(text) => text.id }
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Login({ navigation }) {
const useInfo = await AsyncStorage.getItem(STORAGE_KEY);
console.log(useInfo);
if (useInfo != null) {
//navigation.navigate("Main_Home");
navigation.navigate("Main_Home");
}
};

Expand Down

0 comments on commit 0631783

Please sign in to comment.