Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
502718440c | ||
|
|
f0cbfd7155 | ||
|
|
9c49991bae | ||
|
|
1b4c65ea97 | ||
|
|
41547a70a5 | ||
|
|
a030046401 | ||
|
|
7557e885d0 | ||
|
|
06fa981954 | ||
|
|
38522e5180 | ||
|
|
ecba5ade66 | ||
|
|
c94508e559 |
@@ -13,7 +13,8 @@
|
|||||||
[status-im2.contexts.contacts.events :as contacts-store]
|
[status-im2.contexts.contacts.events :as contacts-store]
|
||||||
[status-im.multiaccounts.model :as multiaccounts.model]
|
[status-im.multiaccounts.model :as multiaccounts.model]
|
||||||
[status-im.utils.clocks :as utils.clocks]
|
[status-im.utils.clocks :as utils.clocks]
|
||||||
[status-im.utils.types :as types]))
|
[status-im.utils.types :as types]
|
||||||
|
[reagent.core :as reagent]))
|
||||||
|
|
||||||
(defn- get-chat
|
(defn- get-chat
|
||||||
[cofx chat-id]
|
[cofx chat-id]
|
||||||
@@ -338,6 +339,13 @@
|
|||||||
[{:keys [db]} shared-element-id]
|
[{:keys [db]} shared-element-id]
|
||||||
{:db (assoc db :shared-element-id shared-element-id)})
|
{:db (assoc db :shared-element-id shared-element-id)})
|
||||||
|
|
||||||
|
(rf/defn navigate-to-lightbox
|
||||||
|
{:events [:chat.ui/navigate-to-lightbox]}
|
||||||
|
[{:keys [db]} shared-element-id screen-params]
|
||||||
|
(let [updated-db (assoc db :shared-element-id shared-element-id)]
|
||||||
|
(reagent/next-tick #(rf/dispatch [:navigate-to :lightbox screen-params]))
|
||||||
|
{:db updated-db}))
|
||||||
|
|
||||||
(rf/defn exit-lightbox-signal
|
(rf/defn exit-lightbox-signal
|
||||||
{:events [:chat.ui/exit-lightbox-signal]}
|
{:events [:chat.ui/exit-lightbox-signal]}
|
||||||
[{:keys [db]} value]
|
[{:keys [db]} value]
|
||||||
@@ -357,4 +365,3 @@
|
|||||||
{:events [:chat.ui/lightbox-scale]}
|
{:events [:chat.ui/lightbox-scale]}
|
||||||
[{:keys [db]} value]
|
[{:keys [db]} value]
|
||||||
{:db (assoc db :lightbox/scale value)})
|
{:db (assoc db :lightbox/scale value)})
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
(anim/animate background-color :transparent)
|
(anim/animate background-color :transparent)
|
||||||
(anim/animate opacity 0)
|
(anim/animate opacity 0)
|
||||||
(rf/dispatch (if platform/ios?
|
(rf/dispatch (if platform/ios?
|
||||||
[:chat.ui/exit-lightbox-signal @index]
|
[:navigate-back]
|
||||||
[:navigate-back])))
|
[:navigate-back])))
|
||||||
:style style/close-container}
|
:style style/close-container}
|
||||||
[quo/icon :close {:size 20 :color colors/white}]]
|
[quo/icon :close {:size 20 :color colors/white}]]
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[quo2.foundations.colors :as colors]
|
[quo2.foundations.colors :as colors]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
|
[react-native.fast-image :as fast-image]
|
||||||
[react-native.navigation :as navigation]
|
[react-native.navigation :as navigation]
|
||||||
[react-native.orientation :as orientation]
|
[react-native.orientation :as orientation]
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
@@ -189,6 +190,7 @@
|
|||||||
(rf/dispatch [:chat.ui/zoom-out-signal nil])
|
(rf/dispatch [:chat.ui/zoom-out-signal nil])
|
||||||
(when platform/android?
|
(when platform/android?
|
||||||
(rf/dispatch [:chat.ui/lightbox-scale 1])))))
|
(rf/dispatch [:chat.ui/lightbox-scale 1])))))
|
||||||
|
|
||||||
[:f>
|
[:f>
|
||||||
(fn []
|
(fn []
|
||||||
(let [curr-orientation (or (rf/sub [:lightbox/orientation]) orientation/portrait)
|
(let [curr-orientation (or (rf/sub [:lightbox/orientation]) orientation/portrait)
|
||||||
@@ -202,13 +204,18 @@
|
|||||||
window-height
|
window-height
|
||||||
window-width)
|
window-width)
|
||||||
item-width (if (and landscape? platform/ios?) screen-height screen-width)]
|
item-width (if (and landscape? platform/ios?) screen-height screen-width)]
|
||||||
|
;[gesture/flat-list
|
||||||
|
; {:data [1]
|
||||||
|
; :horizontal true
|
||||||
|
; :render-fn (fn [] [rn/view {:style {:width 300 :height 300 :background-color :red}
|
||||||
|
; :native-ID :shared-element}])}]
|
||||||
[reanimated/view
|
[reanimated/view
|
||||||
{:style (reanimated/apply-animations-to-style {:background-color (:background-color
|
{:style (reanimated/apply-animations-to-style {:background-color (:background-color
|
||||||
animations)}
|
animations)}
|
||||||
{:height screen-height})}
|
{:height screen-height})}
|
||||||
(when-not @transparent?
|
;(when-not @transparent?
|
||||||
[top-view/top-view (first messages) insets scroll-index animations derived landscape?
|
; [top-view/top-view (first messages) insets scroll-index animations derived landscape?
|
||||||
screen-width])
|
; screen-width])
|
||||||
[gesture/gesture-detector
|
[gesture/gesture-detector
|
||||||
{:gesture (drag-gesture animations (and landscape? platform/ios?) set-full-height?)}
|
{:gesture (drag-gesture animations (and landscape? platform/ios?) set-full-height?)}
|
||||||
[reanimated/view
|
[reanimated/view
|
||||||
@@ -221,7 +228,8 @@
|
|||||||
:key-fn :message-id
|
:key-fn :message-id
|
||||||
:style {:width (+ screen-width seperator-width)}
|
:style {:width (+ screen-width seperator-width)}
|
||||||
:data @data
|
:data @data
|
||||||
:render-fn image
|
:render-fn (fn [] [rn/view {:style {:width 300 :height 300 :background-color :red}
|
||||||
|
:native-ID :shared-element}])
|
||||||
:render-data {:opacity-value (:opacity animations)
|
:render-data {:opacity-value (:opacity animations)
|
||||||
:border-value (:border animations)
|
:border-value (:border animations)
|
||||||
:transparent? transparent?
|
:transparent? transparent?
|
||||||
@@ -240,6 +248,9 @@
|
|||||||
:shows-vertical-scroll-indicator false
|
:shows-vertical-scroll-indicator false
|
||||||
:shows-horizontal-scroll-indicator false
|
:shows-horizontal-scroll-indicator false
|
||||||
:on-viewable-items-changed callback}]]]
|
:on-viewable-items-changed callback}]]]
|
||||||
(when (and (not @transparent?) (not landscape?))
|
;(when (and (not @transparent?) (not landscape?))
|
||||||
[bottom-view/bottom-view messages index scroll-index insets animations derived
|
; [bottom-view/bottom-view messages index scroll-index insets animations derived
|
||||||
item-width atoms])]))]))])
|
; item-width atoms])
|
||||||
|
]
|
||||||
|
))]
|
||||||
|
))])
|
||||||
|
|||||||
@@ -272,7 +272,12 @@
|
|||||||
animations
|
animations
|
||||||
@set-full-height?
|
@set-full-height?
|
||||||
(= curr-orientation orientation/portrait))}
|
(= curr-orientation orientation/portrait))}
|
||||||
[reanimated/fast-image
|
[rn/view {:style {:width 300 :height 300 :background-color :red}
|
||||||
{:source {:uri (:image content)}
|
:native-ID :shared-element}]
|
||||||
:native-ID (when focused? :shared-element)
|
;[reanimated/fast-image
|
||||||
:style (style/image dimensions animations (:border-value args))}]]]))]))])
|
; {:source {:uri (:image content)}
|
||||||
|
; ;:native-ID (when focused? :shared-element)
|
||||||
|
; :native-ID :shared-element
|
||||||
|
; :style (style/image dimensions animations (:border-value args))}]
|
||||||
|
]]
|
||||||
|
))]))])
|
||||||
|
|||||||
@@ -52,19 +52,19 @@
|
|||||||
{:key (:message-id item)
|
{:key (:message-id item)
|
||||||
:active-opacity 1
|
:active-opacity 1
|
||||||
:on-long-press #(on-long-press message context)
|
:on-long-press #(on-long-press message context)
|
||||||
:on-press (fn []
|
:on-press #(rf/dispatch [:chat.ui/navigate-to-lightbox
|
||||||
(rf/dispatch [:chat.ui/update-shared-element-id (:message-id item)])
|
(:message-id item)
|
||||||
(js/setTimeout #(rf/dispatch [:navigate-to :lightbox
|
{:messages (:album message)
|
||||||
{:messages (:album message)
|
:index index
|
||||||
:index index
|
:insets insets}])}
|
||||||
:insets insets}])
|
|
||||||
100))}
|
|
||||||
[fast-image/fast-image
|
[fast-image/fast-image
|
||||||
{:style (style/image dimensions index portrait? images-count)
|
{:style (style/image dimensions index portrait? images-count)
|
||||||
:source {:uri (:image (:content item))}
|
:source {:uri (:image (:content item))}
|
||||||
:native-ID (when (and (= shared-element-id (:message-id item))
|
:native-ID :source-image
|
||||||
(< index constants/max-album-photos))
|
;:native-ID (when (and (= shared-element-id (:message-id item))
|
||||||
:shared-element)}]
|
; (< index constants/max-album-photos))
|
||||||
|
; :shared-element)
|
||||||
|
}]
|
||||||
(when (and (> images-count constants/max-album-photos)
|
(when (and (> images-count constants/max-album-photos)
|
||||||
(= index (- constants/max-album-photos 1)))
|
(= index (- constants/max-album-photos 1)))
|
||||||
[rn/view
|
[rn/view
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
(:require
|
(:require
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.fast-image :as fast-image]
|
[react-native.fast-image :as fast-image]
|
||||||
|
[react-native.reanimated :as reanimated]
|
||||||
[react-native.safe-area :as safe-area]
|
[react-native.safe-area :as safe-area]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
@@ -24,19 +25,23 @@
|
|||||||
(let [shared-element-id (rf/sub [:shared-element-id])]
|
(let [shared-element-id (rf/sub [:shared-element-id])]
|
||||||
[rn/touchable-opacity
|
[rn/touchable-opacity
|
||||||
{:active-opacity 1
|
{:active-opacity 1
|
||||||
|
;:native-ID :source-image
|
||||||
:key message-id
|
:key message-id
|
||||||
:style {:margin-top (when (pos? index) 10)}
|
:style {:margin-top (when (pos? index) 10)}
|
||||||
:on-long-press on-long-press
|
:on-long-press on-long-press
|
||||||
:on-press (fn []
|
:on-press #(rf/dispatch [:chat.ui/navigate-to-lightbox
|
||||||
(rf/dispatch [:chat.ui/update-shared-element-id message-id])
|
message-id
|
||||||
(js/setTimeout #(rf/dispatch [:navigate-to :lightbox
|
{:messages [message]
|
||||||
{:messages [message]
|
:index 0
|
||||||
:index 0
|
:insets insets}])}
|
||||||
:insets insets}])
|
|
||||||
100))}
|
|
||||||
(when (and (not= text "placeholder") (= index 0))
|
(when (and (not= text "placeholder") (= index 0))
|
||||||
[rn/view {:style {:margin-bottom 10}} [text/text-content message context]])
|
[rn/view {:style {:margin-bottom 10}} [text/text-content message context]])
|
||||||
[fast-image/fast-image
|
[rn/view {:style {:width 300 :height 300 :background-color :red}
|
||||||
{:source {:uri (:image content)}
|
:native-ID :shared-element}]
|
||||||
:style (merge dimensions {:border-radius 12})
|
;[fast-image/fast-image
|
||||||
:native-ID (when (= shared-element-id message-id) :shared-element)}]]))))])
|
; {:source {:uri (:image content)}
|
||||||
|
; :style (merge dimensions {:border-radius 12})
|
||||||
|
; :native-ID :shared-element
|
||||||
|
; ;:native-ID (when (= shared-element-id message-id) :shared-element)
|
||||||
|
; }]
|
||||||
|
]))))])
|
||||||
|
|||||||
@@ -64,7 +64,8 @@
|
|||||||
|
|
||||||
{:name :lightbox
|
{:name :lightbox
|
||||||
:insets {:top false :bottom false}
|
:insets {:top false :bottom false}
|
||||||
:options {:topBar {:visible false}
|
:options {
|
||||||
|
:topBar {:visible false}
|
||||||
:statusBar {:backgroundColor :transparent
|
:statusBar {:backgroundColor :transparent
|
||||||
:style :light
|
:style :light
|
||||||
:animate true
|
:animate true
|
||||||
@@ -75,13 +76,15 @@
|
|||||||
:backgroundColor :transparent}
|
:backgroundColor :transparent}
|
||||||
:animations {:push {:sharedElementTransitions [{:fromId :shared-element
|
:animations {:push {:sharedElementTransitions [{:fromId :shared-element
|
||||||
:toId :shared-element
|
:toId :shared-element
|
||||||
:interpolation {:type :decelerate
|
:interpolation {:type
|
||||||
|
:decelerate
|
||||||
:factor 1.5}}]}
|
:factor 1.5}}]}
|
||||||
:pop {:sharedElementTransitions [{:fromId :shared-element
|
:pop {:sharedElementTransitions [{:fromId :shared-element
|
||||||
:toId :shared-element
|
:toId :shared-element
|
||||||
:interpolation {:type
|
:interpolation {:type
|
||||||
:decelerate
|
:decelerate
|
||||||
:factor 1.5}}]}}}
|
:factor 1.5}}]}
|
||||||
|
}}
|
||||||
:component lightbox/lightbox}
|
:component lightbox/lightbox}
|
||||||
{:name :photo-selector
|
{:name :photo-selector
|
||||||
:options {:topBar {:visible false}}
|
:options {:topBar {:visible false}}
|
||||||
|
|||||||
Reference in New Issue
Block a user