From e64777f1d07019508f7919bbbdfadc0888310ce4 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Mon, 22 Jul 2019 12:42:46 +0200 Subject: [PATCH] [#7723] Stickers are not tappable right after install Signed-off-by: Andrey Shovkoplyas --- src/status_im/stickers/core.cljs | 4 +-- .../ui/screens/chat/message/message.cljs | 2 +- .../ui/screens/chat/stickers/views.cljs | 36 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/status_im/stickers/core.cljs b/src/status_im/stickers/core.cljs index ff52ff6128..cfbb8095a6 100644 --- a/src/status_im/stickers/core.cljs +++ b/src/status_im/stickers/core.cljs @@ -103,8 +103,8 @@ (fx/merge cofx {:db (-> db - (assoc-in [:stickers/packs-installed id] pack) - (assoc :stickers/selected-pack id))} + (assoc-in [:stickers/packs-installed id] pack))} + ;;(assoc :stickers/selected-pack id))} TODO it doesn't scroll to selected pack on Android (multiaccounts/update-stickers (conj (:stickers multiaccount) (pr-str pack)))))) (defn valid-sticker? [sticker] diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index e0e904f8bc..9f2e901e6e 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -257,7 +257,7 @@ (if (and platform/desktop? (= "right" (.-button (.-nativeEvent arg)))) (open-chat-context-menu message) (do - (when (= content-type constants/content-type-sticker) + (when (and (= content-type constants/content-type-sticker) (:pack content)) (re-frame/dispatch [:stickers/open-sticker-pack (:pack content)])) (re-frame/dispatch [:chat.ui/set-chat-ui-props {:messages-focused? true :show-stickers? false}]) diff --git a/src/status_im/ui/screens/chat/stickers/views.cljs b/src/status_im/ui/screens/chat/stickers/views.cljs index 3adba1ae09..491a16b5fb 100644 --- a/src/status_im/ui/screens/chat/stickers/views.cljs +++ b/src/status_im/ui/screens/chat/stickers/views.cljs @@ -80,25 +80,25 @@ (re-frame/dispatch [:stickers/select-pack pack-id])))) (defview stickers-paging-panel [installed-packs selected-pack] - (letsubs [ref (atom nil) - window-width [:dimensions/window-width] - content-width (reagent/atom 0)] + (letsubs [ref (atom nil) + width [:dimensions/window-width]] {:component-will-update (fn [_ [_ installed-packs selected-pack]] - (update-scroll-position @ref installed-packs selected-pack window-width)) - :component-did-mount #(update-scroll-position @ref installed-packs selected-pack window-width)} - (let [width @content-width] - [react/scroll-view {:style {:flex 1} :horizontal true :paging-enabled true - :ref #(reset! ref %) - :shows-horizontal-scroll-indicator false - :on-momentum-scroll-end #(on-scroll % installed-packs window-width) - :scrollEventThrottle 8 - :on-scroll #(reset! scroll-x (.-nativeEvent.contentOffset.x %)) - :on-layout #(reset! content-width (-> % .-nativeEvent .-layout .-width))} - ^{:key "recent"} - [recent-stickers-panel width] - (for [{:keys [stickers id]} installed-packs] - ^{:key (str "sticker" id)} - [stickers-panel (map #(assoc % :pack id) (filter stickers/valid-sticker? stickers)) width])]))) + (update-scroll-position @ref installed-packs selected-pack width)) + :component-did-mount #(update-scroll-position @ref installed-packs selected-pack width)} + [react/scroll-view {:style {:flex 1} + :horizontal true + :paging-enabled true + :ref #(reset! ref %) + :shows-horizontal-scroll-indicator false + :on-momentum-scroll-end #(on-scroll % installed-packs width) + :scroll-event-throttle 8 + :scroll-to-overflow-enabled true + :on-scroll #(reset! scroll-x (.-nativeEvent.contentOffset.x %))} + ^{:key "recent"} + [recent-stickers-panel width] + (for [{:keys [stickers id]} installed-packs] + ^{:key (str "sticker" id)} + [stickers-panel (map #(assoc % :pack id) (filter stickers/valid-sticker? stickers)) width])])) (defn pack-icon [{:keys [id on-press background-color] :or {on-press #(re-frame/dispatch [:stickers/select-pack id])}}