Browse Source

fix: popup can't be scrolled

Tienson Qin 4 months ago
parent
commit
7c627db203
2 changed files with 24 additions and 17 deletions
  1. 1 1
      src/main/mobile/components/app.css
  2. 23 16
      src/main/mobile/components/popup.cljs

+ 1 - 1
src/main/mobile/components/app.css

@@ -157,6 +157,7 @@ ul {
 
   .app-silk-scroll-content {
     @apply min-h-screen;
+    padding-bottom: 200px;
   }
 }
 
@@ -335,7 +336,6 @@ ul {
   overflow: hidden;
   overflow: clip;
   position: relative;
-  padding-bottom: 200px;
 }
 
 html[data-silk-native-page-scroll-replaced=false] .app-silk-index-scroll-view {

+ 23 - 16
src/main/mobile/components/popup.cljs

@@ -101,19 +101,26 @@
        (silkhq/bottom-sheet-content
         {:class "flex flex-col items-center p-2"}
         (silkhq/bottom-sheet-handle)
-        (let [title (or (:title opts) (when (string? content-fn) content-fn))
-              content (if (fn? content-fn)
-                        [:div {:style (cond-> {}
-                                        (or (nil? default-height) (number? default-height))
-                                        (assoc :min-height (or default-height 300)))}
-                         (content-fn)]
-                        (if-let [buttons (and action-sheet? (:buttons opts))]
-                          [:div.-mx-2
-                           (for [{:keys [role text]} buttons]
-                             (ui/menu-link {:on-click #(some-> (:on-action opts) (apply [{:role role}]))
-                                            :data-role role}
-                                           [:span.text-lg.flex.items-center text]))]
-                          (when-not (string? content-fn) content-fn)))]
-          [:div.w-full.app-silk-popup-content-inner.p-2
-           (when title [:h2.py-2.opacity-40 title])
-           content])))))))
+        (silkhq/scroll
+         {:as-child true}
+         (silkhq/scroll-view
+          {:class "app-silk-scroll-view overflow-y-scroll"
+           :scrollGestureTrap {:yEnd true}
+           :style {:min-height (if (number? default-height)
+                                 default-height
+                                 400)
+                   :max-height "80vh"}}
+          (silkhq/scroll-content
+           (let [title (or (:title opts) (when (string? content-fn) content-fn))
+                 content (if (fn? content-fn)
+                           (content-fn)
+                           (if-let [buttons (and action-sheet? (:buttons opts))]
+                             [:div.-mx-2
+                              (for [{:keys [role text]} buttons]
+                                (ui/menu-link {:on-click #(some-> (:on-action opts) (apply [{:role role}]))
+                                               :data-role role}
+                                              [:span.text-lg.flex.items-center text]))]
+                             (when-not (string? content-fn) content-fn)))]
+             [:div.w-full.app-silk-popup-content-inner.p-2
+              (when title [:h2.py-2.opacity-40 title])
+              content]))))))))))