|
64 | 64 | (oops/oget event "nativeEvent.layout.height"))
|
65 | 65 |
|
66 | 66 | (defn view
|
67 |
| - [{:keys [hide? insets keyboard-vertical-offset]} |
| 67 | + [{:keys [hide? insets]} |
68 | 68 | {:keys [content selected-item padding-bottom-override border-radius on-close shell?
|
69 | 69 | gradient-cover? customization-color hide-handle? blur-radius]
|
70 | 70 | :or {border-radius 12}}]
|
71 | 71 | (let [theme (quo.theme/use-theme-value)
|
72 | 72 | [sheet-height set-sheet-height] (rn/use-state 0)
|
| 73 | + [layout-height set-layout-height] (rn/use-state 0) |
73 | 74 | handle-sheet-height (rn/use-callback (fn [e]
|
74 | 75 | (when (= sheet-height 0)
|
75 | 76 | (set-sheet-height
|
76 | 77 | (get-layout-height e))))
|
77 | 78 | [sheet-height])
|
| 79 | + handle-layout-height (rn/use-callback (fn [e] |
| 80 | + (-> (get-layout-height e) |
| 81 | + (set-layout-height)))) |
78 | 82 | [item-height set-item-height] (rn/use-state 0)
|
79 |
| - {:keys [keyboard-height]} (hooks/use-keyboard) |
80 | 83 | handle-item-height (rn/use-callback (fn [e]
|
81 | 84 | (when (= item-height 0)
|
82 | 85 | (set-item-height
|
|
100 | 103 | bottom (if selected-item-smaller-than-sheet?
|
101 | 104 | (+ sheet-height bottom-margin)
|
102 | 105 | (:bottom insets))
|
103 |
| - sheet-max-height (- window-height |
104 |
| - (:top insets) |
105 |
| - keyboard-height |
106 |
| - (when platform/ios? |
107 |
| - keyboard-vertical-offset)) |
| 106 | + sheet-max-height (- layout-height |
| 107 | + (:top insets)) |
108 | 108 | content-padding-bottom (or padding-bottom-override
|
109 | 109 | (+ (:bottom insets) bottom-margin))]
|
110 | 110 | (rn/use-effect
|
|
117 | 117 | (on-close))
|
118 | 118 | (rf/dispatch [:hide-bottom-sheet])
|
119 | 119 | true))
|
120 |
| - [rn/view {:style {:flex 1}} |
| 120 | + [rn/view {:style {:flex 1} |
| 121 | + :on-layout handle-layout-height} |
121 | 122 | ;; backdrop
|
122 | 123 | [rn/pressable
|
123 | 124 | {:on-press #(rf/dispatch [:hide-bottom-sheet])
|
|
0 commit comments