From 16f4e2c4534ccbdea5b5803483bd04c7f1de656e Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 5 Jul 2022 22:59:39 +0500 Subject: [PATCH] set scedule date to null when schedule status changed --- src/screens/editor/children/postOptionsModal.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/screens/editor/children/postOptionsModal.tsx b/src/screens/editor/children/postOptionsModal.tsx index b7ceaff3a..beedcf6e9 100644 --- a/src/screens/editor/children/postOptionsModal.tsx +++ b/src/screens/editor/children/postOptionsModal.tsx @@ -79,7 +79,7 @@ const PostOptionsModal = forwardRef(({ handleScheduleChange(scheduledFor) } }, [scheduleLater, scheduledFor]) -*/ +*/ useEffect(() => { if(scheduledFor){ handleScheduleChange(scheduledFor); @@ -87,9 +87,12 @@ const PostOptionsModal = forwardRef(({ },[scheduledFor]) useEffect(() => { - if(scheduledForDate){ + if (scheduledForDate) { setScheduleLater(true); setScheduledFor(scheduledForDate); + } else { + setScheduleLater(false); + setScheduledFor(''); } },[scheduledForDate]) @@ -155,8 +158,11 @@ const PostOptionsModal = forwardRef(({ intl.formatMessage({id:"editor.scheduled_later"}), ]} selectedOptionIndex={scheduleLater ? 1 : 0} - handleOnChange={(index)=>{ - setScheduleLater(index === 1) + handleOnChange={(index)=> { + setScheduleLater(index === 1); + if (index !== 1) { + handleScheduleChange(null); + } }} />