Photo selector fix (#14646)

* fix: photo-selector
This commit is contained in:
Omar Basem 2022-12-28 14:40:13 +04:00 committed by GitHub
parent 4ce71e4d29
commit b45261f2e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -13,7 +13,11 @@
:style style/small-image}] :style style/small-image}]
[rn/touchable-opacity [rn/touchable-opacity
{:on-press (fn [] (rf/dispatch [:chat.ui/image-unselected (first item)])) {:on-press (fn [] (rf/dispatch [:chat.ui/image-unselected (first item)]))
:style style/remove-photo-container} :style style/remove-photo-container
:hit-slop {:right 5
:left 5
:top 10
:bottom 10}}
[quo2/icon :i/close {:color colors/white :size 12}]]]) [quo2/icon :i/close {:color colors/white :size 12}]]])
(defn images-list (defn images-list
@ -24,5 +28,5 @@
:data images :data images
:horizontal true :horizontal true
:style {:bottom 50 :position :absolute :z-index 5 :elevation 5} :style {:bottom 50 :position :absolute :z-index 5 :elevation 5}
:content-container-style {:padding-horizontal 20 :margin-top 12} :content-container-style {:padding-horizontal 20 :margin-top 12 :padding-top 8}
:separator [rn/view {:style {:width 12}}]}]) :separator [rn/view {:style {:width 12}}]}])

View File

@ -14,11 +14,11 @@
(def selected (reagent/atom [])) (def selected (reagent/atom []))
(defn bottom-gradient (defn bottom-gradient
[] [chat-id selected-images]
[:f> [:f>
(fn [] (fn []
(let [safe-area (safe-area/use-safe-area)] (let [safe-area (safe-area/use-safe-area)]
(when (pos? (count @selected)) (when (or (pos? (count @selected)) selected-images)
[linear-gradient/linear-gradient [linear-gradient/linear-gradient
{:colors [:black :transparent] {:colors [:black :transparent]
:start {:x 0 :y 1} :start {:x 0 :y 1}
@ -28,6 +28,7 @@
{:style {:align-self :stretch {:style {:align-self :stretch
:margin-horizontal 20} :margin-horizontal 20}
:on-press #(do :on-press #(do
(rf/dispatch [:chat.ui/clear-sending-images chat-id])
(doseq [item @selected] (doseq [item @selected]
(rf/dispatch [:chat.ui/camera-roll-pick item])) (rf/dispatch [:chat.ui/camera-roll-pick item]))
(reset! selected []) (reset! selected [])
@ -97,4 +98,5 @@
:style {:border-radius 20} :style {:border-radius 20}
:on-end-reached #(rf/dispatch [:camera-roll/on-end-reached end-cursor loading? :on-end-reached #(rf/dispatch [:camera-roll/on-end-reached end-cursor loading?
has-next-page?])}] has-next-page?])}]
[bottom-gradient]]))])) [bottom-gradient chat-id selected-images]]))]))