Skip to content

Commit

Permalink
Merge pull request #81 from Amattang/fix/#80-iosQa
Browse files Browse the repository at this point in the history
Fix/#80 ios qa
  • Loading branch information
SJLEE316 authored Apr 6, 2022
2 parents cfc2bc5 + f371a8f commit 4fde5e7
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 24 deletions.
4 changes: 2 additions & 2 deletions components/Login/KakaoLoginBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion components/Map/AddressItem.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 32 additions & 6 deletions components/Map/AddressItem.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,30 +12,55 @@ type Props = {
checkList: checkListTypes;
latitude: number;
longitude: number;
setFullAddress: Dispatch<SetStateAction<string>>;
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<string>('');
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 (
Expand Down
5 changes: 1 addition & 4 deletions components/Map/Modal.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 8 additions & 3 deletions components/Map/ModalAddress.tsx
Original file line number Diff line number Diff line change
@@ -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<OnBoardingStackProps>();

// @brief 주소검색창 - 데이터 조회
const [isModal, setModal] = useState<boolean>(false);
const [fullAddress, setFullAddress] = useState<String>('직접입력');

return (
<>
Expand All @@ -34,15 +36,18 @@ const ModalAddress = () => {
}}
onSelected={(data) => {
setModal(false);
navigation.navigate('map', { activeType: false, address: data.address });
navigation.navigate('map', {
activeType: false,
address: data.address,
});
}}
/>
</Modal>
<Pressable
onPress={() => setModal(true)}
style={[styles.directInputOfAddress, styles.buttonOfCheckList]}
>
<DefaultText style={styles.directInputTextOfAddress}>직접입력</DefaultText>
<DefaultText style={styles.directInputTextOfAddress}>{fullAddress}</DefaultText>
</Pressable>
</>
);
Expand Down
8 changes: 5 additions & 3 deletions components/Onboarding/AddressItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import { styles } from './AddressItem.style';

type Props = {
address: string | undefined;
// setFullAddress : Dispatch<SetStateAction<string>>;
setFullAddress: Dispatch<SetStateAction<String>>;
activeType: boolean;
};

const AddressItem = ({ address }: Props) => {
const AddressItem = ({ address, setFullAddress, activeType }: Props) => {
const navigation = useNavigation();

const [specificAddress, onChangeText] = useState<string>('');
const fullAddress = `${address} ${specificAddress}`;

return (
<View style={styles.container}>
Expand All @@ -25,8 +27,8 @@ const AddressItem = ({ address }: Props) => {
/>
<Pressable
onPress={() => {
console.log('onboarding이야!');
navigation.goBack();
!activeType && setFullAddress(fullAddress);
}}
style={[styles.addressBtn, styles.bottomBtn]}
>
Expand Down
6 changes: 5 additions & 1 deletion screens/Landing/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ function Map({ route }: any) {
<DefaultText>Loading...</DefaultText>
)}
<GoNowPosition setLocation={setLocation} coordToAddress={coordToAddress} />
<AddressItem address={doroAddress} />
<AddressItem
address={doroAddress}
setFullAddress={params.setFullAddress}
activeType={params.activeType}
/>
</View>
);
}
Expand Down
20 changes: 16 additions & 4 deletions screens/bottomTab/BottomMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
})
Expand All @@ -76,7 +77,7 @@ const BottomMap = () => {

return (
<View style={{ flex: 1 }}>
{locations && locations?.length !== 0 ? (
{locations ? (
<MapView
style={{ flex: 1 }}
provider={PROVIDER_GOOGLE}
Expand Down Expand Up @@ -104,7 +105,18 @@ const BottomMap = () => {
))}
</MapView>
) : (
<EmptyHome />
<MapView
style={{ flex: 1 }}
provider={PROVIDER_GOOGLE}
region={{
latitude: 37.498095,
longitude: 127.02761,
latitudeDelta: 0.0122,
longitudeDelta: 0.0021,
}}
zoomEnabled={true}
showsScale={true}
/>
)}
{locations && locations?.length !== 0 && (
<View style={styles.carContainer}>
Expand Down
1 change: 1 addition & 0 deletions screens/bottomTab/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions screens/bottomTab/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function Map({ route }: any) {
checkList={params.checkList}
latitude={latitude}
longitude={longitude}
setFullAddress={params.setFullAddress}
activeType={params.activeType}
/>
</View>
);
Expand Down

0 comments on commit 4fde5e7

Please sign in to comment.