[14849] Only allow dragging inside bottom sheet when no handle is shown (#14850)
This commit is contained in:
parent
080b13c304
commit
7f2623a23e
|
@ -83,6 +83,16 @@
|
|||
(and @expanded? (< end-pan-y collapse-threshold))
|
||||
(reset! expanded? false))))))))
|
||||
|
||||
(defn handle-comp
|
||||
[window-width]
|
||||
[rn/view
|
||||
{:style {:width window-width
|
||||
:position :absolute
|
||||
:background-color :transparent
|
||||
:top 0
|
||||
:height 20}}
|
||||
[rn/view {:style (styles/handle)}]])
|
||||
|
||||
(defn bottom-sheet
|
||||
[props children]
|
||||
(let [{on-cancel :on-cancel
|
||||
|
@ -140,7 +150,9 @@
|
|||
expandable?
|
||||
show-bottom-sheet?
|
||||
expanded?
|
||||
close-bottom-sheet)]
|
||||
close-bottom-sheet)
|
||||
handle-comp [gesture/gesture-detector {:gesture bottom-sheet-gesture}
|
||||
[handle-comp window-width]]]
|
||||
|
||||
(react/effect! #(do
|
||||
(cond
|
||||
|
@ -200,9 +212,7 @@
|
|||
{:style (reanimated/apply-animations-to-style
|
||||
{:opacity bg-opacity}
|
||||
styles/backdrop)}]]
|
||||
|
||||
[gesture/gesture-detector {:gesture bottom-sheet-gesture}
|
||||
[reanimated/view
|
||||
(cond->> [reanimated/view
|
||||
{:style (reanimated/apply-animations-to-style
|
||||
{:transform [{:translateY translate-y}]}
|
||||
{:width window-width
|
||||
|
@ -222,6 +232,7 @@
|
|||
(> @content-height 0))
|
||||
on-content-layout)}
|
||||
children]]
|
||||
|
||||
(when show-handle?
|
||||
[rn/view {:style (styles/handle)}])]]]]]))])]))
|
||||
handle-comp)]]]
|
||||
(not show-handle?)
|
||||
(conj [gesture/gesture-detector {:gesture bottom-sheet-gesture}]))]))])]))
|
||||
|
|
Loading…
Reference in New Issue