Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]: Tapping outside quickly after clear status leads the user going back to the report screen #40364

Merged
merged 11 commits into from
May 29, 2024
20 changes: 18 additions & 2 deletions src/pages/settings/Profile/CustomStatus/StatusPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@
return DateUtils.isTimeAtLeastOneMinuteInFuture({dateTimeString: clearAfterTime});
}, [draftClearAfter, currentUserClearAfter]);

const navigateBackToPreviousScreenTask = useRef<{
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
then: (onfulfilled?: () => any, onrejected?: () => any) => Promise<any>;

Check failure on line 78 in src/pages/settings/Profile/CustomStatus/StatusPage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected any. Specify a different type

Check failure on line 78 in src/pages/settings/Profile/CustomStatus/StatusPage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected any. Specify a different type

Check failure on line 78 in src/pages/settings/Profile/CustomStatus/StatusPage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected any. Specify a different type
done: (...args: any[]) => any;

Check failure on line 79 in src/pages/settings/Profile/CustomStatus/StatusPage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected any. Specify a different type

Check failure on line 79 in src/pages/settings/Profile/CustomStatus/StatusPage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected any. Specify a different type
cancel: () => void;
} | null>(null);

useEffect(() => {

Check failure on line 83 in src/pages/settings/Profile/CustomStatus/StatusPage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
return () => {
if (!navigateBackToPreviousScreenTask.current) {
return;
}

navigateBackToPreviousScreenTask.current.cancel();
};
}, []);

const navigateBackToPreviousScreen = useCallback(() => Navigation.goBack(), []);
const updateStatus = useCallback(
({emojiCode, statusText}: FormOnyxValues<typeof ONYXKEYS.FORMS.SETTINGS_STATUS_SET_FORM>) => {
Expand All @@ -90,7 +106,7 @@
clearAfter: clearAfterTime !== CONST.CUSTOM_STATUS_TYPES.NEVER ? clearAfterTime : '',
});
User.clearDraftCustomStatus();
InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreenTask.current = InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreen();
});
},
Expand All @@ -106,7 +122,7 @@
});
formRef.current?.resetForm({[INPUT_IDS.EMOJI_CODE]: ''});

InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreenTask.current = InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreen();
});
};
Expand Down
Loading