Reset bottom sheet on subsequent opens
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage]
|
||||
[status-im.ui.screens.multiaccounts.recover.views :as recover.views]
|
||||
[status-im2.common.bottom-sheet.view :as bottom-sheet]
|
||||
[status-im2.contexts.chat.messages.pin.list.view :as pin.list]))
|
||||
[status-im2.contexts.chat.messages.pin.list.view :as pin.list]
|
||||
[reagent.core :as reagent]))
|
||||
|
||||
(defn bottom-sheet
|
||||
[]
|
||||
@@ -47,6 +48,10 @@
|
||||
|
||||
(= view :pinned-messages-list)
|
||||
(merge {:content pin.list/pinned-messages-list}))]
|
||||
[bottom-sheet/bottom-sheet opts
|
||||
(when content
|
||||
[content (when options options)])]))
|
||||
(reagent/create-class {:reagent-render (fn []
|
||||
[bottom-sheet/bottom-sheet opts
|
||||
(when content
|
||||
[content (when options options)])])
|
||||
:component-will-unmount (fn []
|
||||
(when @bottom-sheet/show-bottom-sheet?
|
||||
(bottom-sheet/reset-atoms)))})))
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
[status-im.ui2.screens.common.contact-list.view :as contact-list]
|
||||
[quo2.components.markdown.text :as text]
|
||||
[status-im.ui.components.invite.events :as invite.events]
|
||||
[status-im.ui2.screens.chat.components.new-chat.styles :as style]))
|
||||
[status-im.ui2.screens.chat.components.new-chat.styles :as style]
|
||||
[status-im2.common.bottom-sheet.view :as bottom-sheet]))
|
||||
|
||||
(defn- on-toggle
|
||||
[allow-new-users? checked? public-key]
|
||||
@@ -71,8 +72,8 @@
|
||||
[quo2/button
|
||||
{:type :grey
|
||||
:icon true
|
||||
:on-press #(rf/dispatch [:bottom-sheet/hide])
|
||||
:style style/contact-selection-close
|
||||
:on-press #(bottom-sheet/close-bottom-sheet-fn nil)
|
||||
:style style/contact-selection-close
|
||||
:override-background-color (quo2.colors/theme-colors quo2.colors/neutral-10
|
||||
quo2.colors/neutral-90)}
|
||||
:i/close]
|
||||
|
||||
@@ -83,6 +83,15 @@
|
||||
(and @expanded? (< end-pan-y collapse-threshold))
|
||||
(reset! expanded? false))))))))
|
||||
|
||||
(defn close-bottom-sheet-fn [on-cancel]
|
||||
(reset! show-bottom-sheet? false)
|
||||
(when (fn? on-cancel) (on-cancel))
|
||||
(timer/set-timeout
|
||||
#(do
|
||||
(re-frame/dispatch [:bottom-sheet/hide-navigation-overlay])
|
||||
(reset-atoms))
|
||||
animation-delay))
|
||||
|
||||
(defn bottom-sheet
|
||||
[props children]
|
||||
(let [{on-cancel :on-cancel
|
||||
@@ -96,14 +105,7 @@
|
||||
backdrop-dismiss? true
|
||||
expandable? false}}
|
||||
props
|
||||
close-bottom-sheet (fn []
|
||||
(reset! show-bottom-sheet? false)
|
||||
(when (fn? on-cancel) (on-cancel))
|
||||
(timer/set-timeout
|
||||
#(do
|
||||
(re-frame/dispatch [:bottom-sheet/hide-navigation-overlay])
|
||||
(reset-atoms))
|
||||
animation-delay))]
|
||||
close-bottom-sheet #(close-bottom-sheet-fn on-cancel)]
|
||||
[safe-area/consumer
|
||||
(fn [insets]
|
||||
[:f>
|
||||
@@ -114,7 +116,7 @@
|
||||
window-height (if selected-item (- height 72) height)
|
||||
{:keys [keyboard-shown]} (hooks/use-keyboard)
|
||||
bg-height-expanded (- window-height (:top insets))
|
||||
bg-height (max (min @content-height bg-height-expanded) 200)
|
||||
bg-height (max (min @content-height bg-height-expanded) 150)
|
||||
bottom-sheet-dy (reanimated/use-shared-value 0)
|
||||
pan-y (reanimated/use-shared-value 0)
|
||||
translate-y (.useTranslateY ^js bottom-sheet-js window-height bottom-sheet-dy pan-y)
|
||||
|
||||
Reference in New Issue
Block a user