[#7723] Stickers are not tappable right after install
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
f0269bc732
commit
e64777f1d0
|
@ -103,8 +103,8 @@
|
||||||
(fx/merge
|
(fx/merge
|
||||||
cofx
|
cofx
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:stickers/packs-installed id] pack)
|
(assoc-in [:stickers/packs-installed id] pack))}
|
||||||
(assoc :stickers/selected-pack id))}
|
;;(assoc :stickers/selected-pack id))} TODO it doesn't scroll to selected pack on Android
|
||||||
(multiaccounts/update-stickers (conj (:stickers multiaccount) (pr-str pack))))))
|
(multiaccounts/update-stickers (conj (:stickers multiaccount) (pr-str pack))))))
|
||||||
|
|
||||||
(defn valid-sticker? [sticker]
|
(defn valid-sticker? [sticker]
|
||||||
|
|
|
@ -257,7 +257,7 @@
|
||||||
(if (and platform/desktop? (= "right" (.-button (.-nativeEvent arg))))
|
(if (and platform/desktop? (= "right" (.-button (.-nativeEvent arg))))
|
||||||
(open-chat-context-menu message)
|
(open-chat-context-menu message)
|
||||||
(do
|
(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 [:stickers/open-sticker-pack (:pack content)]))
|
||||||
(re-frame/dispatch [:chat.ui/set-chat-ui-props {:messages-focused? true
|
(re-frame/dispatch [:chat.ui/set-chat-ui-props {:messages-focused? true
|
||||||
:show-stickers? false}])
|
:show-stickers? false}])
|
||||||
|
|
|
@ -80,25 +80,25 @@
|
||||||
(re-frame/dispatch [:stickers/select-pack pack-id]))))
|
(re-frame/dispatch [:stickers/select-pack pack-id]))))
|
||||||
|
|
||||||
(defview stickers-paging-panel [installed-packs selected-pack]
|
(defview stickers-paging-panel [installed-packs selected-pack]
|
||||||
(letsubs [ref (atom nil)
|
(letsubs [ref (atom nil)
|
||||||
window-width [:dimensions/window-width]
|
width [:dimensions/window-width]]
|
||||||
content-width (reagent/atom 0)]
|
|
||||||
{:component-will-update (fn [_ [_ installed-packs selected-pack]]
|
{:component-will-update (fn [_ [_ installed-packs selected-pack]]
|
||||||
(update-scroll-position @ref installed-packs selected-pack window-width))
|
(update-scroll-position @ref installed-packs selected-pack width))
|
||||||
:component-did-mount #(update-scroll-position @ref installed-packs selected-pack window-width)}
|
:component-did-mount #(update-scroll-position @ref installed-packs selected-pack width)}
|
||||||
(let [width @content-width]
|
[react/scroll-view {:style {:flex 1}
|
||||||
[react/scroll-view {:style {:flex 1} :horizontal true :paging-enabled true
|
:horizontal true
|
||||||
:ref #(reset! ref %)
|
:paging-enabled true
|
||||||
:shows-horizontal-scroll-indicator false
|
:ref #(reset! ref %)
|
||||||
:on-momentum-scroll-end #(on-scroll % installed-packs window-width)
|
:shows-horizontal-scroll-indicator false
|
||||||
:scrollEventThrottle 8
|
:on-momentum-scroll-end #(on-scroll % installed-packs width)
|
||||||
:on-scroll #(reset! scroll-x (.-nativeEvent.contentOffset.x %))
|
:scroll-event-throttle 8
|
||||||
:on-layout #(reset! content-width (-> % .-nativeEvent .-layout .-width))}
|
:scroll-to-overflow-enabled true
|
||||||
^{:key "recent"}
|
:on-scroll #(reset! scroll-x (.-nativeEvent.contentOffset.x %))}
|
||||||
[recent-stickers-panel width]
|
^{:key "recent"}
|
||||||
(for [{:keys [stickers id]} installed-packs]
|
[recent-stickers-panel width]
|
||||||
^{:key (str "sticker" id)}
|
(for [{:keys [stickers id]} installed-packs]
|
||||||
[stickers-panel (map #(assoc % :pack id) (filter stickers/valid-sticker? stickers)) width])])))
|
^{: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]
|
(defn pack-icon [{:keys [id on-press background-color]
|
||||||
:or {on-press #(re-frame/dispatch [:stickers/select-pack id])}}
|
:or {on-press #(re-frame/dispatch [:stickers/select-pack id])}}
|
||||||
|
|
Loading…
Reference in New Issue