From ca963fa492ceaa02428e24c06459f57976d7cfff Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 23 Jun 2025 17:12:13 +0800 Subject: [PATCH] enhance: set initial breakpoint to 0.75 Otherwise, options could be blocked by keyboard --- src/main/capacitor/components/popup.cljs | 38 ++++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/capacitor/components/popup.cljs b/src/main/capacitor/components/popup.cljs index 1a47e4304a..9a2f89619a 100644 --- a/src/main/capacitor/components/popup.cljs +++ b/src/main/capacitor/components/popup.cljs @@ -13,13 +13,13 @@ vh js/window.innerHeight [th bh] [y (- vh (+ y height) 300)]] (case (if (> bh 280) "bottom" - (if (> (- th bh) 100) - "top" "bottom")) + (if (> (- th bh) 100) + "top" "bottom")) "top" ["top" th] ["bottom" bh]))] (-> (assoc opts :auto-side? false) - (assoc :max-popup-height mh) - (assoc-in [:content-props :side] side)))) + (assoc :max-popup-height mh) + (assoc-in [:content-props :side] side)))) (defn popup-show! [event content-fn {:keys [id dropdown-menu?] :as opts}] @@ -29,7 +29,7 @@ side (some-> opts :content-props :side) max-h (some-> opts :max-popup-height (js/parseInt) (- 48)) _ (when max-h (js/document.documentElement.style.setProperty - (str "--" side "-popup-content-max-height") (str max-h "px"))) + (str "--" side "-popup-content-max-height") (str max-h "px"))) pid (shui-popup/show! event content-fn opts)] (reset! *last-popup-modal? false) pid) @@ -56,17 +56,17 @@ [] (let [{:keys [open? content-fn opts]} (rum/react state/*popup-data)] (ion/modal - (merge - {:isOpen (boolean open?) - :initialBreakpoint 0.5 - :breakpoints #js [0 0.5 0.75 1] - :onDidDismiss (fn [] (state/set-popup! nil)) - :expand "block"} - (:modal-props opts)) - (ion/content - {:class "ion-padding"} - [:<> - (when-let [title (:title opts)] - [:h2.py-2.opacity-40 title]) - (when content-fn - (content-fn))])))) + (merge + {:isOpen (boolean open?) + :initialBreakpoint 0.75 + :breakpoints #js [0 0.5 0.75 1] + :onDidDismiss (fn [] (state/set-popup! nil)) + :expand "block"} + (:modal-props opts)) + (ion/content + {:class "ion-padding"} + [:<> + (when-let [title (:title opts)] + [:h2.py-2.opacity-40 title]) + (when content-fn + (content-fn))]))))