Skip to content

Commit 8f85e3c

Browse files
authoredFeb 19, 2024
fix first tap doesn't work when selecting a photo in the gallery (#18885)
1 parent ed427cf commit 8f85e3c

File tree

9 files changed

+28
-23
lines changed

9 files changed

+28
-23
lines changed
 

‎src/status_im/common/bottom_sheet_screen/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
[content
8888
{:insets insets
8989
:close close
90-
:scroll-enabled? @scroll-enabled?
90+
:scroll-enabled? scroll-enabled?
9191
:current-scroll curr-scroll
9292
:on-scroll #(on-scroll % curr-scroll)
9393
:sheet-animating? animating?}]]]]))))

‎src/status_im/common/emoji_picker/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
on-select set-scroll-ref close sheet-animating?]}]
9999
[gesture/flat-list
100100
{:ref set-scroll-ref
101-
:scroll-enabled scroll-enabled?
101+
:scroll-enabled @scroll-enabled?
102102
:data (or filtered-data emoji-picker.data/flatten-data)
103103
:initial-num-to-render 14
104104
:max-to-render-per-batch 10

‎src/status_im/contexts/chat/home/new_chat/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
:render-section-header-fn contact-list/contacts-section-header
106106
:content-container-style {:padding-bottom 70}
107107
:render-fn contact-item-render
108-
:scroll-enabled scroll-enabled?
108+
:scroll-enabled @scroll-enabled?
109109
:on-scroll on-scroll}])
110110
(when contacts-selected?
111111
[quo/button

‎src/status_im/contexts/chat/messenger/composer/actions/view.cljs

+6-7
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@
182182

183183
(defn open-photo-selector
184184
[{:keys [input-ref]}
185-
{:keys [height]}
186-
insets]
185+
{:keys [height]}]
187186
(permissions/request-permissions
188187
{:permissions [(if platform/is-below-android-13? :read-external-storage :read-media-images)
189188
:write-external-storage]
@@ -192,18 +191,18 @@
192191
(.blur ^js @input-ref))
193192
(rf/dispatch [:chat.ui/set-input-content-height
194193
(reanimated/get-shared-value height)])
195-
(rf/dispatch [:open-modal :photo-selector {:insets insets}]))
194+
(rf/dispatch [:photo-selector/navigate-to-photo-selector]))
196195
:on-denied (fn []
197196
(alert.effects/show-popup (i18n/label :t/error)
198197
(i18n/label
199198
:t/external-storage-denied)))}))
200199

201200
(defn image-button
202-
[props animations insets edit]
201+
[props animations edit]
203202
[quo/composer-button
204203
{:on-press (if edit
205204
#(js/alert "This feature is temporarily unavailable in edit mode.")
206-
#(open-photo-selector props animations insets))
205+
#(open-photo-selector props animations))
207206
:accessibility-label :open-images-button
208207
:container-style {:margin-right 12}
209208
:icon :i/image}])
@@ -228,15 +227,15 @@
228227
:icon :i/format}])
229228

230229
(defn view
231-
[props state animations window-height insets {:keys [edit images]}]
230+
[props state animations window-height {:keys [edit images]}]
232231
(let [send-btn-opacity (reanimated/use-shared-value 0)
233232
audio-btn-opacity (reanimated/interpolate send-btn-opacity [0 1] [1 0])]
234233
[rn/view {:style style/actions-container}
235234
[rn/view
236235
{:style {:flex-direction :row
237236
:display (if @(:recording? state) :none :flex)}}
238237
[camera-button edit]
239-
[image-button props animations insets edit]
238+
[image-button props animations edit]
240239
[reaction-button]
241240
[format-button]]
242241
[:f> send-button props state animations window-height images edit send-btn-opacity]

‎src/status_im/contexts/chat/messenger/composer/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
[gradients/view props state animations show-bottom-gradient?]
143143
[link-preview/view]
144144
[images/images-list]]
145-
[:f> actions/view props state animations window-height insets subscriptions]]]]]))
145+
[:f> actions/view props state animations window-height subscriptions]]]]]))
146146

147147
(defn f-composer
148148
[props]

‎src/status_im/contexts/chat/messenger/photo_selector/album_selector/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
:content-container-style {:padding-top 64
8888
:padding-bottom 40}
8989
:key-fn key-fn
90-
:scroll-enabled scroll-enabled?
90+
:scroll-enabled @scroll-enabled?
9191
:on-scroll on-scroll
9292
:style {:height window-height}}]]))
9393

‎src/status_im/contexts/chat/messenger/photo_selector/events.cljs

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(ns status-im.contexts.chat.messenger.photo-selector.events
22
(:require
3+
[re-frame.core :as re-frame]
34
[status-im.constants :as constants]
45
status-im.contexts.chat.messenger.photo-selector.effects
56
[utils.i18n :as i18n]
@@ -74,3 +75,9 @@
7475
(when (and (< (count images) constants/max-album-photos)
7576
(not (some #(= (:uri image) (:uri %)) images)))
7677
{:effects.camera-roll/image-selected [image current-chat-id]})))
78+
79+
(re-frame/reg-event-fx :photo-selector/navigate-to-photo-selector
80+
(fn []
81+
{:fx [[:dispatch [:open-modal :photo-selector]]
82+
[:dispatch [:photo-selector/get-photos-for-selected-album]]
83+
[:dispatch [:photo-selector/camera-roll-get-albums]]]}))

‎src/status_im/contexts/chat/messenger/photo_selector/view.cljs

+9-10
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@
7070
(let [customization-color (rf/sub [:profile/customization-color])
7171
item-selected? (some #(= (:uri item) (:uri %)) @selected)]
7272
[rn/touchable-opacity
73-
{:on-press (fn []
74-
(if item-selected?
75-
(swap! selected remove-selected item)
76-
(if (>= (count @selected) constants/max-album-photos)
77-
(show-photo-limit-toast)
78-
(swap! selected conj item))))
79-
:accessibility-label (str "image-" index)}
73+
{:on-press (fn []
74+
(if item-selected?
75+
(swap! selected remove-selected item)
76+
(if (>= (count @selected) constants/max-album-photos)
77+
(show-photo-limit-toast)
78+
(swap! selected conj item))))
79+
:allow-multiple-presses? true
80+
:accessibility-label (str "image-" index)}
8081
[rn/image
8182
{:source {:uri (:uri item)}
8283
:style (style/image window-width index)}]
@@ -91,8 +92,6 @@
9192

9293
(defn photo-selector
9394
[{:keys [scroll-enabled? on-scroll current-scroll close] :as sheet}]
94-
(rf/dispatch [:photo-selector/get-photos-for-selected-album])
95-
(rf/dispatch [:photo-selector/camera-roll-get-albums])
9695
(let [album? (reagent/atom false)
9796
customization-color (rf/sub [:profile/customization-color])
9897
sending-image (into [] (vals (rf/sub [:chats/sending-image])))
@@ -134,7 +133,7 @@
134133
:padding-bottom (+ (safe-area/get-bottom) 100)
135134
:padding-top 64}
136135
:on-scroll on-scroll
137-
:scroll-enabled scroll-enabled?
136+
:scroll-enabled @scroll-enabled?
138137
:on-end-reached (fn []
139138
(when (and (not loading?) has-next-page?)
140139
(rf/dispatch [:photo-selector/camera-roll-loading-more true])

‎src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
:share-all-addresses? share-all-addresses?
9393
:community-color color}
9494
:content-container-style {:padding-horizontal 20}
95-
:scroll-enabled scroll-enabled?
95+
:scroll-enabled @scroll-enabled?
9696
:on-scroll on-scroll
9797
:key-fn :address
9898
:data accounts}]

0 commit comments

Comments
 (0)
Please sign in to comment.