From 4e90eb52a697dbeaeddb267eac10142ffde09849 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 5 May 2025 12:09:30 +0200 Subject: [PATCH 1/3] Revert "Revert status bar changes" This reverts commit 664c03cdb4410b40d70e589fc5426c34c26f69a3. --- src/components/Modal/BaseModal.tsx | 8 ++++++- src/components/Modal/index.tsx | 35 +++++++++++++++++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/components/Modal/BaseModal.tsx b/src/components/Modal/BaseModal.tsx index fd44f593f189d..1576f17ad886f 100644 --- a/src/components/Modal/BaseModal.tsx +++ b/src/components/Modal/BaseModal.tsx @@ -52,6 +52,8 @@ function BaseModal( innerContainerStyle = {}, outerStyle, onModalShow = () => {}, + onModalWillShow, + onModalWillHide, propagateSwipe, fullscreen = true, animationIn, @@ -269,7 +271,11 @@ function BaseModal( onModalShow={handleShowModal} propagateSwipe={propagateSwipe} onModalHide={hideModal} - onModalWillShow={saveFocusState} + onModalWillShow={() => { + saveFocusState(); + onModalWillShow?.(); + }} + onModalWillHide={onModalWillHide} onDismiss={handleDismissModal} onSwipeComplete={() => onClose?.()} swipeDirection={swipeDirection} diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index 16907a590852a..deca4d0901f1e 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -21,7 +21,6 @@ function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = ( }; const hideModal = () => { - setStatusBarColor(previousStatusBarColor); onModalHide(); if ((window.history.state as WindowState)?.shouldGoBack) { window.history.back(); @@ -33,6 +32,21 @@ function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = ( }); const showModal = () => { + if (shouldHandleNavigationBack) { + window.history.pushState({shouldGoBack: true}, '', null); + window.addEventListener('popstate', handlePopStateRef.current); + } + onModalShow?.(); + }; + + useEffect( + () => () => { + window.removeEventListener('popstate', handlePopStateRef.current); + }, + [], + ); + + const onModalWillShow = () => { const statusBarColor = StatusBar.getBackgroundColor() ?? theme.appBG; const isFullScreenModal = @@ -46,20 +60,13 @@ function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = ( // If it is a full screen modal then match it with appBG, otherwise we use the backdrop color setStatusBarColor(isFullScreenModal ? theme.appBG : StyleUtils.getThemeBackgroundColor(statusBarColor)); } - - if (shouldHandleNavigationBack) { - window.history.pushState({shouldGoBack: true}, '', null); - window.addEventListener('popstate', handlePopStateRef.current); - } - onModalShow?.(); + rest.onModalWillShow?.(); }; - useEffect( - () => () => { - window.removeEventListener('popstate', handlePopStateRef.current); - }, - [], - ); + const onModalWillHide = () => { + setStatusBarColor(previousStatusBarColor); + rest.onModalWillHide?.(); + }; return ( {}, type, onModalShow = ( {...rest} onModalHide={hideModal} onModalShow={showModal} + onModalWillShow={onModalWillShow} + onModalWillHide={onModalWillHide} avoidKeyboard={false} fullscreen={fullscreen} useNativeDriver={false} From 755137bef302ce6b86ac8bf4541e55329f51188b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 19 May 2025 10:50:07 +0200 Subject: [PATCH 2/3] Bring back changes after conflicts --- src/components/Modal/BaseModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Modal/BaseModal.tsx b/src/components/Modal/BaseModal.tsx index dd7c8a3f90c7e..5ca6eda9de5eb 100644 --- a/src/components/Modal/BaseModal.tsx +++ b/src/components/Modal/BaseModal.tsx @@ -280,7 +280,11 @@ function BaseModal( onModalShow={handleShowModal} propagateSwipe={propagateSwipe} onModalHide={hideModal} - onModalWillShow={saveFocusState} + onModalWillShow={() => { + saveFocusState(); + onModalWillShow?.(); + }} + onModalWillHide={onModalWillHide} onDismiss={handleDismissModal} onSwipeComplete={() => onClose?.()} swipeDirection={swipeDirection} From 382bd6ad7b389680747f3eff044d3a863caa7528 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 19 May 2025 12:44:36 +0200 Subject: [PATCH 3/3] Remove onModalWillHide call from cleanup effect in BottomDockedModal --- src/components/Modal/BottomDockedModal/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Modal/BottomDockedModal/index.tsx b/src/components/Modal/BottomDockedModal/index.tsx index 953eabae10b8c..801fbe23cdf43 100644 --- a/src/components/Modal/BottomDockedModal/index.tsx +++ b/src/components/Modal/BottomDockedModal/index.tsx @@ -101,7 +101,6 @@ function BottomDockedModal({ useEffect( () => () => { - onModalWillHide(); if (handleRef.current) { InteractionManager.clearInteractionHandle(handleRef.current); }