From 917ea371a0868eaa4d4a1a1d110ec5150725978c Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Tue, 13 Dec 2022 09:14:39 +0200 Subject: [PATCH] Fix ios keyboard tracking and profile status theme (#6859) * add listener when screen is popped * Fix profile status theme --- app/components/profile_picture/status.tsx | 2 +- app/hooks/keyboard_tracking.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/components/profile_picture/status.tsx b/app/components/profile_picture/status.tsx index ef82320b66..52546266df 100644 --- a/app/components/profile_picture/status.tsx +++ b/app/components/profile_picture/status.tsx @@ -38,7 +38,7 @@ const Status = ({author, statusSize, statusStyle, theme}: Props) => { styles.statusWrapper, statusStyle, {borderRadius: statusSize / 2}, - ]), [statusStyle]); + ]), [statusStyle, styles]); const isBot = author && (('isBot' in author) ? author.isBot : author.is_bot); if (author?.status && !isBot) { return ( diff --git a/app/hooks/keyboard_tracking.ts b/app/hooks/keyboard_tracking.ts index 806b21ff02..0a9a31ce27 100644 --- a/app/hooks/keyboard_tracking.ts +++ b/app/hooks/keyboard_tracking.ts @@ -11,6 +11,14 @@ export const useKeyboardTrackingPaused = (keyboardTrackingRef: RefObject { + const onCommandComplete = () => { + const id = NavigationStore.getVisibleScreen(); + if (screens.includes(id) && isPostDraftPaused.current) { + isPostDraftPaused.current = false; + keyboardTrackingRef.current?.resumeTracking(trackerId); + } + }; + const commandListener = Navigation.events().registerCommandListener(() => { if (!isPostDraftPaused.current) { isPostDraftPaused.current = true; @@ -19,16 +27,17 @@ export const useKeyboardTrackingPaused = (keyboardTrackingRef: RefObject { - const id = NavigationStore.getVisibleScreen(); - if (screens.includes(id) && isPostDraftPaused.current) { - isPostDraftPaused.current = false; - keyboardTrackingRef.current?.resumeTracking(trackerId); - } + onCommandComplete(); + }); + + const popListener = Navigation.events().registerScreenPoppedListener(() => { + onCommandComplete(); }); return () => { commandListener.remove(); commandCompletedListener.remove(); + popListener.remove(); }; }, [trackerId]); };