fix android hardware back button is not working for nested sheet-screens (#18886)

This commit is contained in:
Parvesh Monu 2024-02-19 22:42:34 +05:30 committed by GitHub
parent 107f263fb1
commit f394fcc3d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,6 @@
[quo.theme :as theme] [quo.theme :as theme]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.gesture :as gesture] [react-native.gesture :as gesture]
[react-native.hooks :as hooks]
[react-native.platform :as platform] [react-native.platform :as platform]
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area] [react-native.safe-area :as safe-area]
@ -58,7 +57,8 @@
(set-animating-true) (set-animating-true)
(reanimated/animate translate-y height 300) (reanimated/animate translate-y height 300)
(reanimated/animate opacity 0 300) (reanimated/animate opacity 0 300)
(rf/dispatch [:navigate-back])) (rf/dispatch [:navigate-back])
true)
reset-open-sheet (fn [] reset-open-sheet (fn []
(reanimated/animate translate-y 0 300) (reanimated/animate translate-y 0 300)
(reanimated/animate opacity 1 300) (reanimated/animate opacity 1 300)
@ -66,10 +66,11 @@
(reset! scroll-enabled? true))] (reset! scroll-enabled? true))]
(rn/use-effect (rn/use-effect
(fn [] (fn []
(rn/hw-back-add-listener close)
(reanimated/animate translate-y 0 300) (reanimated/animate translate-y 0 300)
(reanimated/animate opacity 1 300) (reanimated/animate opacity 1 300)
(set-animating-false 300))) (set-animating-false 300)
(hooks/use-back-handler close) #(rn/hw-back-remove-listener close)))
[rn/view {:style (style/container insets)} [rn/view {:style (style/container insets)}
(when-not skip-background? (when-not skip-background?
[reanimated/view {:style (style/background opacity)}]) [reanimated/view {:style (style/background opacity)}])