diff --git a/components/CheckListComponent/ButtonsOfTypeC.tsx b/components/CheckListComponent/ButtonsOfTypeC.tsx index 7bd1ee8..960906e 100644 --- a/components/CheckListComponent/ButtonsOfTypeC.tsx +++ b/components/CheckListComponent/ButtonsOfTypeC.tsx @@ -1,4 +1,4 @@ -import React, { Dispatch, SetStateAction } from 'react'; +import React, { Dispatch, SetStateAction, useState } from 'react'; import { DefaultText } from '../../CustomText'; import { checkListTypes } from '../../types/checkListTypes'; import { Image, Pressable, View } from 'react-native'; @@ -12,6 +12,7 @@ interface IProps { } function ButtonsOfTypeC({ setModal, modal, checkList }: IProps) { + const [order, setOrder] = useState(0); return ( <> @@ -21,6 +22,7 @@ function ButtonsOfTypeC({ setModal, modal, checkList }: IProps) { key={item.id} onPress={() => { setModal ? setModal(true) : null; + setOrder(item.order); }} > {checkList?.answer?.some((item) => item.id) ? ( - + ) : null} ); diff --git a/components/CheckListComponent/CheckListImage.tsx b/components/CheckListComponent/CheckListImage.tsx index 18996fd..4899f4e 100644 --- a/components/CheckListComponent/CheckListImage.tsx +++ b/components/CheckListComponent/CheckListImage.tsx @@ -2,7 +2,7 @@ import React, { Dispatch, SetStateAction, useContext, useRef, useState } from 'r import { DefaultText } from '../../CustomText'; import Modal from 'react-native-modal'; import { Dimensions, Image, Pressable, View } from 'react-native'; -import Carousel, { Pagination } from 'react-native-snap-carousel'; +import Carousel from 'react-native-snap-carousel'; import { answerButtonType } from '../../types/checkListTypes'; import styles from './styles'; import axios from 'axios'; @@ -12,10 +12,11 @@ interface IProps { checkList: answerButtonType[]; setModal?: Dispatch>; modal?: boolean; + order: number; } const windowWidth = Dimensions.get('window').width; -function CheckListImage({ checkList, setModal, modal }: IProps) { +function CheckListImage({ checkList, setModal, modal, order }: IProps) { const checkListContext = useContext(checkListCtx); const [index, setIndex] = useState(0); const isCarousel = useRef(null); @@ -33,11 +34,15 @@ function CheckListImage({ checkList, setModal, modal }: IProps) { setModal ? setModal(false) : null; } }; + console.log(checkList); const renderItem = ({ item }: any) => { return ( + + {item.order + 1} / {checkList.length} + mainImageHandler(item)}> 대표 사진으로 설정 @@ -57,6 +62,7 @@ function CheckListImage({ checkList, setModal, modal }: IProps) {