Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

Commit 7f2623a

Browse files
authored
[14849] Only allow dragging inside bottom sheet when no handle is shown (#14850)
1 parent 080b13c commit 7f2623a

1 file changed

Lines changed: 37 additions & 26 deletions

File tree

src/status_im2/common/bottom_sheet/view.cljs

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@
8383
(and @expanded? (< end-pan-y collapse-threshold))
8484
(reset! expanded? false))))))))
8585

86+
(defn handle-comp
87+
[window-width]
88+
[rn/view
89+
{:style {:width window-width
90+
:position :absolute
91+
:background-color :transparent
92+
:top 0
93+
:height 20}}
94+
[rn/view {:style (styles/handle)}]])
95+
8696
(defn bottom-sheet
8797
[props children]
8898
(let [{on-cancel :on-cancel
@@ -140,7 +150,9 @@
140150
expandable?
141151
show-bottom-sheet?
142152
expanded?
143-
close-bottom-sheet)]
153+
close-bottom-sheet)
154+
handle-comp [gesture/gesture-detector {:gesture bottom-sheet-gesture}
155+
[handle-comp window-width]]]
144156

145157
(react/effect! #(do
146158
(cond
@@ -200,28 +212,27 @@
200212
{:style (reanimated/apply-animations-to-style
201213
{:opacity bg-opacity}
202214
styles/backdrop)}]]
203-
204-
[gesture/gesture-detector {:gesture bottom-sheet-gesture}
205-
[reanimated/view
206-
{:style (reanimated/apply-animations-to-style
207-
{:transform [{:translateY translate-y}]}
208-
{:width window-width
209-
:height window-height})}
210-
[rn/view {:style styles/container}
211-
(when selected-item
212-
[rn/view {:style (styles/selected-background)}
213-
[selected-item]])
214-
[rn/view {:style (styles/background)}
215-
[rn/keyboard-avoiding-view
216-
{:behaviour (if platform/ios? :padding :height)
217-
:style {:flex 1}}
218-
[rn/view
219-
{:style (styles/content-style insets)
220-
:on-layout (when-not (and
221-
(some? @content-height)
222-
(> @content-height 0))
223-
on-content-layout)}
224-
children]]
225-
226-
(when show-handle?
227-
[rn/view {:style (styles/handle)}])]]]]]))])]))
215+
(cond->> [reanimated/view
216+
{:style (reanimated/apply-animations-to-style
217+
{:transform [{:translateY translate-y}]}
218+
{:width window-width
219+
:height window-height})}
220+
[rn/view {:style styles/container}
221+
(when selected-item
222+
[rn/view {:style (styles/selected-background)}
223+
[selected-item]])
224+
[rn/view {:style (styles/background)}
225+
[rn/keyboard-avoiding-view
226+
{:behaviour (if platform/ios? :padding :height)
227+
:style {:flex 1}}
228+
[rn/view
229+
{:style (styles/content-style insets)
230+
:on-layout (when-not (and
231+
(some? @content-height)
232+
(> @content-height 0))
233+
on-content-layout)}
234+
children]]
235+
(when show-handle?
236+
handle-comp)]]]
237+
(not show-handle?)
238+
(conj [gesture/gesture-detector {:gesture bottom-sheet-gesture}]))]))])]))

0 commit comments

Comments
 (0)