[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))
|
(and @expanded? (< end-pan-y collapse-threshold))
|
||||||
(reset! expanded? false))))))))
|
(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
|
(defn bottom-sheet
|
||||||
[props children]
|
[props children]
|
||||||
(let [{on-cancel :on-cancel
|
(let [{on-cancel :on-cancel
|
||||||
|
@ -140,7 +150,9 @@
|
||||||
expandable?
|
expandable?
|
||||||
show-bottom-sheet?
|
show-bottom-sheet?
|
||||||
expanded?
|
expanded?
|
||||||
close-bottom-sheet)]
|
close-bottom-sheet)
|
||||||
|
handle-comp [gesture/gesture-detector {:gesture bottom-sheet-gesture}
|
||||||
|
[handle-comp window-width]]]
|
||||||
|
|
||||||
(react/effect! #(do
|
(react/effect! #(do
|
||||||
(cond
|
(cond
|
||||||
|
@ -200,9 +212,7 @@
|
||||||
{:style (reanimated/apply-animations-to-style
|
{:style (reanimated/apply-animations-to-style
|
||||||
{:opacity bg-opacity}
|
{:opacity bg-opacity}
|
||||||
styles/backdrop)}]]
|
styles/backdrop)}]]
|
||||||
|
(cond->> [reanimated/view
|
||||||
[gesture/gesture-detector {:gesture bottom-sheet-gesture}
|
|
||||||
[reanimated/view
|
|
||||||
{:style (reanimated/apply-animations-to-style
|
{:style (reanimated/apply-animations-to-style
|
||||||
{:transform [{:translateY translate-y}]}
|
{:transform [{:translateY translate-y}]}
|
||||||
{:width window-width
|
{:width window-width
|
||||||
|
@ -222,6 +232,7 @@
|
||||||
(> @content-height 0))
|
(> @content-height 0))
|
||||||
on-content-layout)}
|
on-content-layout)}
|
||||||
children]]
|
children]]
|
||||||
|
|
||||||
(when show-handle?
|
(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