mirror of
https://github.com/status-im/status-react.git
synced 2025-01-12 12:04:52 +00:00
parent
6bdadd9f0d
commit
e55a9326d6
@ -13,3 +13,5 @@
|
|||||||
(def ^:const velocity-factor 0.5)
|
(def ^:const velocity-factor 0.5)
|
||||||
|
|
||||||
(def ^:const default-duration 300)
|
(def ^:const default-duration 300)
|
||||||
|
|
||||||
|
(def ^:const default-dimension 1000)
|
||||||
|
@ -216,10 +216,11 @@
|
|||||||
curr-orientation (or (rf/sub [:lightbox/orientation])
|
curr-orientation (or (rf/sub [:lightbox/orientation])
|
||||||
orientation/portrait)
|
orientation/portrait)
|
||||||
portrait? (= curr-orientation orientation/portrait)
|
portrait? (= curr-orientation orientation/portrait)
|
||||||
dimensions (utils/get-dimensions image-width
|
dimensions (utils/get-dimensions
|
||||||
image-height
|
(or image-width c/default-dimension)
|
||||||
curr-orientation
|
(or image-height c/default-duration)
|
||||||
args)
|
curr-orientation
|
||||||
|
args)
|
||||||
animations {:scale (anim/use-val c/min-scale)
|
animations {:scale (anim/use-val c/min-scale)
|
||||||
:saved-scale (anim/use-val c/min-scale)
|
:saved-scale (anim/use-val c/min-scale)
|
||||||
:pan-x-start (anim/use-val c/init-offset)
|
:pan-x-start (anim/use-val c/init-offset)
|
||||||
|
@ -40,12 +40,12 @@
|
|||||||
:size 32} :i/reaction]])
|
:size 32} :i/reaction]])
|
||||||
|
|
||||||
(defn image-button
|
(defn image-button
|
||||||
[]
|
[bottom-inset]
|
||||||
[quo/button
|
[quo/button
|
||||||
{:on-press (fn []
|
{:on-press (fn []
|
||||||
(permissions/request-permissions
|
(permissions/request-permissions
|
||||||
{:permissions [:read-external-storage :write-external-storage]
|
{:permissions [:read-external-storage :write-external-storage]
|
||||||
:on-allowed #(rf/dispatch [:open-modal :photo-selector])
|
:on-allowed #(rf/dispatch [:open-modal :photo-selector {:bottom-inset bottom-inset}])
|
||||||
:on-denied (fn []
|
:on-denied (fn []
|
||||||
(background-timer/set-timeout
|
(background-timer/set-timeout
|
||||||
#(utils-old/show-popup (i18n/label :t/error)
|
#(utils-old/show-popup (i18n/label :t/error)
|
||||||
@ -118,7 +118,7 @@
|
|||||||
(when (and (not @input/recording-audio?)
|
(when (and (not @input/recording-audio?)
|
||||||
(nil? (get @input/reviewing-audio-filepath chat-id)))
|
(nil? (get @input/reviewing-audio-filepath chat-id)))
|
||||||
[:<>
|
[:<>
|
||||||
[image-button]
|
[image-button bottom-inset]
|
||||||
[rn/view {:width 12}]
|
[rn/view {:width 12}]
|
||||||
[reactions-button]
|
[reactions-button]
|
||||||
[rn/view {:flex 1}]
|
[rn/view {:flex 1}]
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
[react-native.platform :as platform]))
|
[react-native.platform :as platform]))
|
||||||
|
|
||||||
(defn gradient-container
|
(defn gradient-container
|
||||||
[insets]
|
[bottom-inset]
|
||||||
{:left 0
|
{:left 0
|
||||||
:right 0
|
:right 0
|
||||||
:height (+ (:bottom insets) (if platform/ios? 65 85))
|
:height (+ bottom-inset (if platform/ios? 65 85))
|
||||||
:position :absolute
|
:position :absolute
|
||||||
:bottom 0})
|
:bottom 0})
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
[status-im2.contexts.chat.photo-selector.style :as style]
|
[status-im2.contexts.chat.photo-selector.style :as style]
|
||||||
[status-im.utils.core :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[quo.react]
|
[quo.react]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]))
|
||||||
[react-native.safe-area :as safe-area]))
|
|
||||||
|
|
||||||
(defn on-press-confirm-selection
|
(defn on-press-confirm-selection
|
||||||
[selected]
|
[selected]
|
||||||
@ -25,13 +24,13 @@
|
|||||||
(rf/dispatch [:navigate-back]))
|
(rf/dispatch [:navigate-back]))
|
||||||
|
|
||||||
(defn bottom-gradient
|
(defn bottom-gradient
|
||||||
[selected-images insets selected]
|
[selected-images bottom-inset selected]
|
||||||
(when (or (seq @selected) (seq selected-images))
|
(when (or (seq @selected) (seq 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}
|
||||||
:end {:x 0 :y 0}
|
:end {:x 0 :y 0}
|
||||||
:style (style/gradient-container insets)}
|
:style (style/gradient-container bottom-inset)}
|
||||||
[quo/button
|
[quo/button
|
||||||
{:style {:align-self :stretch
|
{:style {:align-self :stretch
|
||||||
:margin-horizontal 20
|
:margin-horizontal 20
|
||||||
@ -109,30 +108,32 @@
|
|||||||
|
|
||||||
(defn photo-selector
|
(defn photo-selector
|
||||||
[{:keys [scroll-enabled on-scroll]}]
|
[{:keys [scroll-enabled on-scroll]}]
|
||||||
[safe-area/consumer
|
[:f>
|
||||||
(fn [insets]
|
(let [{:keys [bottom-inset]} (rf/sub [:screen-params]) ; TODO:
|
||||||
[:f>
|
; https://github.com/status-im/status-mobile/issues/15535
|
||||||
(let [temporary-selected (reagent/atom [])] ; used when switching albums
|
temporary-selected (reagent/atom [])] ; used when switching albums
|
||||||
(fn []
|
(fn []
|
||||||
(let [selected (reagent/atom []) ; currently selected
|
(let [selected (reagent/atom []) ; currently selected
|
||||||
selected-images (rf/sub [:chats/sending-image]) ; already selected and dispatched
|
selected-images (rf/sub [:chats/sending-image]) ; already selected and dispatched
|
||||||
selected-album (or (rf/sub [:camera-roll/selected-album]) (i18n/label :t/recent))]
|
selected-album (or (rf/sub [:camera-roll/selected-album]) (i18n/label :t/recent))]
|
||||||
(rn/use-effect
|
(rn/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
(rf/dispatch [:chat.ui/camera-roll-get-photos 20 nil selected-album])
|
(rf/dispatch [:chat.ui/camera-roll-get-photos 20 nil selected-album])
|
||||||
(if (seq selected-images)
|
(if (seq selected-images)
|
||||||
(reset! selected (vec (vals selected-images)))
|
(reset! selected (vec (vals selected-images)))
|
||||||
(reset! selected @temporary-selected)))
|
(reset! selected @temporary-selected)))
|
||||||
[selected-album])
|
[selected-album])
|
||||||
|
[:f>
|
||||||
|
(fn []
|
||||||
(let [window-width (:width (rn/get-window))
|
(let [window-width (:width (rn/get-window))
|
||||||
camera-roll-photos (rf/sub [:camera-roll/photos])
|
camera-roll-photos (rf/sub [:camera-roll/photos])
|
||||||
end-cursor (rf/sub [:camera-roll/end-cursor])
|
end-cursor (rf/sub [:camera-roll/end-cursor])
|
||||||
loading? (rf/sub [:camera-roll/loading-more])
|
loading? (rf/sub [:camera-roll/loading-more])
|
||||||
has-next-page? (rf/sub [:camera-roll/has-next-page])]
|
has-next-page? (rf/sub [:camera-roll/has-next-page])]
|
||||||
[rn/view {:flex 1}
|
[:<>
|
||||||
[rn/view
|
[rn/view
|
||||||
{:style style/buttons-container}
|
{:style style/buttons-container}
|
||||||
[album-title true selected-album selected temporary-selected insets]
|
[album-title true selected-album selected temporary-selected]
|
||||||
[clear-button selected]]
|
[clear-button selected]]
|
||||||
[gesture/flat-list
|
[gesture/flat-list
|
||||||
{:key-fn identity
|
{:key-fn identity
|
||||||
@ -141,11 +142,11 @@
|
|||||||
:data camera-roll-photos
|
:data camera-roll-photos
|
||||||
:num-columns 3
|
:num-columns 3
|
||||||
:content-container-style {:width "100%"
|
:content-container-style {:width "100%"
|
||||||
:padding-bottom (+ (:bottom insets) 100)
|
:padding-bottom (+ (:bottom bottom-inset) 100)
|
||||||
:padding-top 64}
|
:padding-top 64}
|
||||||
:on-scroll on-scroll
|
:on-scroll on-scroll
|
||||||
:scroll-enabled scroll-enabled
|
:scroll-enabled scroll-enabled
|
||||||
:on-end-reached #(rf/dispatch [:camera-roll/on-end-reached end-cursor
|
:on-end-reached #(rf/dispatch [:camera-roll/on-end-reached end-cursor
|
||||||
selected-album loading?
|
selected-album loading?
|
||||||
has-next-page?])}]
|
has-next-page?])}]
|
||||||
[bottom-gradient selected-images insets selected]]))))])])
|
[bottom-gradient selected-images bottom-inset selected]]))])))])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user