Skip to content

Commit

Permalink
fix: edit button 로직 수정
Browse files Browse the repository at this point in the history
수정사항 없을 때 비활성화 되도록 로직 수정했습니다.
  • Loading branch information
dypark26 committed Jan 12, 2023
1 parent 32c0727 commit fef9f27
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/screen/EditPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const EditPage = ({ navigation: { navigate }, route: { params } }) => {
const eachTimeObject = strToObjTime(eachTime);
const [editTime, setEditTime] = useState(eachTimeObject);

// flag. 수정여부를 알려주는 state
const [edited, setEdited] = useState(false);

// time, editTime 옵션 적용된 문자열 시간값으로 전환
const localTime = translateTime(time);
const localEditTime = translateTime(editTime);
Expand Down Expand Up @@ -67,11 +70,6 @@ const EditPage = ({ navigation: { navigate }, route: { params } }) => {
};

// 타임피커 로직

// 시간 표시 옵션
const options = { hour: 'numeric', minute: '2-digit' };
// const [editTime, setEditTime] = useState(eachTime);
// console.log('time', time);
const [isOpenModal, setIsOpenModal] = useState(false);

const handleOpenModal = () => {
Expand All @@ -84,6 +82,7 @@ const EditPage = ({ navigation: { navigate }, route: { params } }) => {

const onChangeEditTime = (event, selectedTime) => {
setEditTime(selectedTime);
setEdited(true);
};

return (
Expand Down Expand Up @@ -117,7 +116,7 @@ const EditPage = ({ navigation: { navigate }, route: { params } }) => {
{isEdit ? (
<CustomButton
onPress={handleEditPill}
disabled={!pillName && eachTimeObject}
disabled={!pillName && !edited}
buttonText="수정"
/>
) : (
Expand Down

0 comments on commit fef9f27

Please sign in to comment.