diff --git a/components/Login/KakaoLoginBtn.tsx b/components/Login/KakaoLoginBtn.tsx index 2aa6429..5741fd9 100644 --- a/components/Login/KakaoLoginBtn.tsx +++ b/components/Login/KakaoLoginBtn.tsx @@ -58,9 +58,9 @@ const KakaoLoginBtn = ({ setIsLogin }: Props) => { } axios.defaults.headers.common['Authorization'] = `Bearer ${accessToken}`; setIsLogin(true); - // const refreshToken = getRefreshToken().then((refreshToken) => console.log(refreshToken)); + const refreshToken = getRefreshToken().then((refreshToken) => console.log(refreshToken)); // accessToken 만료하기 1분 전에 로그인 연장 - // setTimeout(() => requestRefresh(refreshToken), acessTokenExpiresIn - 60000); + setTimeout(() => requestRefresh(refreshToken), acessTokenExpiresIn - 60000); }; const catchError = (err: any) => { diff --git a/components/Map/AddressItem.style.ts b/components/Map/AddressItem.style.ts index 4fa69c5..b7b726d 100644 --- a/components/Map/AddressItem.style.ts +++ b/components/Map/AddressItem.style.ts @@ -17,7 +17,7 @@ export const styles = StyleSheet.create({ borderWidth: 1, borderRadius: 5, width: 200, - lineHeight: 29, + height: 29, padding: 0, marginBottom: 25, paddingLeft: 12, diff --git a/components/Map/AddressItem.tsx b/components/Map/AddressItem.tsx index 3f69e28..a0945ce 100644 --- a/components/Map/AddressItem.tsx +++ b/components/Map/AddressItem.tsx @@ -1,4 +1,5 @@ import { useNavigation } from '@react-navigation/native'; +import axios from 'axios'; import React, { Dispatch, SetStateAction, useContext, useState } from 'react'; import { Pressable, TextInput, View } from 'react-native'; import { checkListCtx } from '../../Context/CheckListByServer'; @@ -11,30 +12,55 @@ type Props = { checkList: checkListTypes; latitude: number; longitude: number; + setFullAddress: Dispatch>; + activeType: boolean; }; -const AddressItem = ({ address, checkList, latitude, longitude }: Props) => { +const AddressItem = ({ + address, + checkList, + latitude, + longitude, + setFullAddress, + activeType, +}: Props) => { const navigation = useNavigation(); const [specificAddress, onChangeText] = useState(''); + const fullAddress = `${address} ${specificAddress}`; const checkListContext = useContext(checkListCtx); const onPressHandler = () => { - console.log('checklist야!'); - navigation.goBack(); - checkListContext?.setChoseCheckListByServer({ ...checkListContext?.choseCheckListByServer, typeM: { questionId: checkList?.questionId, - address, + address: fullAddress, latitude, longitude, }, }); - console.log(checkListContext?.choseCheckListByServer); + !activeType && setFullAddress(fullAddress); + // const data = { + // ...checkListContext?.choseCheckListByServer, + // typeM: { + // questionId: checkList?.questionId, + // address: fullAddress, + // latitude, + // longitude, + // }, + // }; + + // console.log(`data : ${JSON.stringify(data)}`); + + // axios + // .put(`/api/check-list/${checkListContext?.checkListId}/common/question`, data) + // .then((res) => console.log(res)) + // .catch((err) => console.log(err)); + + navigation.goBack(); }; return ( diff --git a/components/Map/Modal.style.ts b/components/Map/Modal.style.ts index 9fcdca3..357632d 100644 --- a/components/Map/Modal.style.ts +++ b/components/Map/Modal.style.ts @@ -17,10 +17,7 @@ export const styles = StyleSheet.create({ height: 102, }, close: { - // position: 'absolute', - // left: 27.58, - // top: 56.58, - // zIndex:1, + zIndex:1, justifyContent: 'center', alignItems: 'center', position: 'absolute', diff --git a/components/Map/ModalAddress.tsx b/components/Map/ModalAddress.tsx index ed9171b..7b8139a 100644 --- a/components/Map/ModalAddress.tsx +++ b/components/Map/ModalAddress.tsx @@ -1,16 +1,18 @@ -import React, { useState } from 'react'; +import React, { useContext, useState } from 'react'; import { Alert, Image, Modal, Pressable, Text, View } from 'react-native'; import Postcode from '@actbase/react-daum-postcode'; import { DefaultText } from '../../CustomText'; import { useNavigation } from '@react-navigation/native'; import { OnBoardingStackProps } from '../../types/navigationTypes'; import { styles } from './Modal.style'; +import { checkListCtx } from '../../Context/CheckListByServer'; const ModalAddress = () => { const navigation = useNavigation(); // @brief 주소검색창 - 데이터 조회 const [isModal, setModal] = useState(false); + const [fullAddress, setFullAddress] = useState('직접입력'); return ( <> @@ -34,7 +36,10 @@ const ModalAddress = () => { }} onSelected={(data) => { setModal(false); - navigation.navigate('map', { activeType: false, address: data.address }); + navigation.navigate('map', { + activeType: false, + address: data.address, + }); }} /> @@ -42,7 +47,7 @@ const ModalAddress = () => { onPress={() => setModal(true)} style={[styles.directInputOfAddress, styles.buttonOfCheckList]} > - 직접입력 + {fullAddress} ); diff --git a/components/Onboarding/AddressItem.tsx b/components/Onboarding/AddressItem.tsx index 0df46a3..1b814fa 100644 --- a/components/Onboarding/AddressItem.tsx +++ b/components/Onboarding/AddressItem.tsx @@ -6,13 +6,15 @@ import { styles } from './AddressItem.style'; type Props = { address: string | undefined; - // setFullAddress : Dispatch>; + setFullAddress: Dispatch>; + activeType: boolean; }; -const AddressItem = ({ address }: Props) => { +const AddressItem = ({ address, setFullAddress, activeType }: Props) => { const navigation = useNavigation(); const [specificAddress, onChangeText] = useState(''); + const fullAddress = `${address} ${specificAddress}`; return ( @@ -25,8 +27,8 @@ const AddressItem = ({ address }: Props) => { /> { - console.log('onboarding이야!'); navigation.goBack(); + !activeType && setFullAddress(fullAddress); }} style={[styles.addressBtn, styles.bottomBtn]} > diff --git a/screens/Landing/Map.tsx b/screens/Landing/Map.tsx index cc8f0fd..bd8bc1f 100644 --- a/screens/Landing/Map.tsx +++ b/screens/Landing/Map.tsx @@ -92,7 +92,11 @@ function Map({ route }: any) { Loading... )} - + ); } diff --git a/screens/bottomTab/BottomMap.tsx b/screens/bottomTab/BottomMap.tsx index 8116769..d34256c 100644 --- a/screens/bottomTab/BottomMap.tsx +++ b/screens/bottomTab/BottomMap.tsx @@ -62,10 +62,11 @@ const BottomMap = () => { .get(`./api/check-list`) .then((res) => { console.log(res.data.data); - setLocations(res.data.data); + const newData = res.data.data.filter((list: any) => list.address !== null); + setLocations(newData); requestPermission().then((result) => { if (result === 'granted') { - setPick(res.data.data[0].location); + setPick(newData[0].location); } }); }) @@ -76,7 +77,7 @@ const BottomMap = () => { return ( - {locations && locations?.length !== 0 ? ( + {locations ? ( { ))} ) : ( - + )} {locations && locations?.length !== 0 && ( diff --git a/screens/bottomTab/Home.tsx b/screens/bottomTab/Home.tsx index f01eca2..1303211 100644 --- a/screens/bottomTab/Home.tsx +++ b/screens/bottomTab/Home.tsx @@ -23,6 +23,7 @@ function Home() { try { const response = await axios.get('/api/check-list'); setHomeCheckList(response.data.data); + console.log(response.data.data); if (response.data.data.length !== 0) setIsCheckList(true); } catch (error) { console.error(error); diff --git a/screens/bottomTab/Map.tsx b/screens/bottomTab/Map.tsx index 7bd1802..6405c4b 100644 --- a/screens/bottomTab/Map.tsx +++ b/screens/bottomTab/Map.tsx @@ -99,6 +99,8 @@ function Map({ route }: any) { checkList={params.checkList} latitude={latitude} longitude={longitude} + setFullAddress={params.setFullAddress} + activeType={params.activeType} /> );