Fix composer opacity on reenter screen (#16010)
* fix: composer opacity on re-enter screen
This commit is contained in:
parent
7fc05bc069
commit
24eaec80bd
|
@ -8,6 +8,7 @@
|
||||||
[status-im.async-storage.core :as async-storage]
|
[status-im.async-storage.core :as async-storage]
|
||||||
[status-im2.contexts.chat.composer.constants :as constants]
|
[status-im2.contexts.chat.composer.constants :as constants]
|
||||||
[status-im2.contexts.chat.composer.keyboard :as kb]
|
[status-im2.contexts.chat.composer.keyboard :as kb]
|
||||||
|
[status-im2.contexts.chat.composer.utils :as utils]
|
||||||
[utils.debounce :as debounce]
|
[utils.debounce :as debounce]
|
||||||
[utils.number :as utils.number]
|
[utils.number :as utils.number]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
@ -83,20 +84,9 @@
|
||||||
(reanimated/animate container-opacity 1)))
|
(reanimated/animate container-opacity 1)))
|
||||||
|
|
||||||
(defn empty-effect
|
(defn empty-effect
|
||||||
[{:keys [text-value maximized? focused?]}
|
[{:keys [container-opacity]}
|
||||||
{:keys [container-opacity]}
|
{:keys [input-text images link-previews? reply audio]}]
|
||||||
images?
|
(when (utils/empty-input? input-text images link-previews? reply audio)
|
||||||
link-previews?
|
|
||||||
reply?
|
|
||||||
audio]
|
|
||||||
(when
|
|
||||||
(and (empty? @text-value)
|
|
||||||
(not images?)
|
|
||||||
(not link-previews?)
|
|
||||||
(not reply?)
|
|
||||||
(not @maximized?)
|
|
||||||
(not @focused?)
|
|
||||||
(not audio))
|
|
||||||
(reanimated/animate-delay container-opacity constants/empty-opacity 200)))
|
(reanimated/animate-delay container-opacity constants/empty-opacity 200)))
|
||||||
|
|
||||||
(defn component-will-unmount
|
(defn component-will-unmount
|
||||||
|
@ -113,7 +103,7 @@
|
||||||
(fn []
|
(fn []
|
||||||
;; Some subscriptions can arrive after the composer if focused (esp. link
|
;; Some subscriptions can arrive after the composer if focused (esp. link
|
||||||
;; previews), so we need to react to changes in `max-height` outside of the
|
;; previews), so we need to react to changes in `max-height` outside of the
|
||||||
;; `on-focus` handler.
|
;; `on-focus` handler
|
||||||
(when @focused?
|
(when @focused?
|
||||||
(let [new-height (min max-height (reanimated/get-shared-value last-height))]
|
(let [new-height (min max-height (reanimated/get-shared-value last-height))]
|
||||||
(reanimated/set-shared-value last-height new-height)
|
(reanimated/set-shared-value last-height new-height)
|
||||||
|
@ -123,7 +113,7 @@
|
||||||
|
|
||||||
(defn initialize
|
(defn initialize
|
||||||
[props state animations {:keys [max-height] :as dimensions}
|
[props state animations {:keys [max-height] :as dimensions}
|
||||||
{:keys [chat-input images link-previews? reply audio]}]
|
{:keys [chat-input images audio] :as subs}]
|
||||||
(max-height-effect state dimensions animations)
|
(max-height-effect state dimensions animations)
|
||||||
(rn/use-effect
|
(rn/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
|
@ -135,7 +125,7 @@
|
||||||
(images-effect props animations images)
|
(images-effect props animations images)
|
||||||
(link-preview-effect state)
|
(link-preview-effect state)
|
||||||
(audio-effect state animations audio)
|
(audio-effect state animations audio)
|
||||||
(empty-effect state animations images link-previews? reply audio)
|
(empty-effect animations subs)
|
||||||
(kb/add-kb-listeners props state animations dimensions)
|
(kb/add-kb-listeners props state animations dimensions)
|
||||||
#(component-will-unmount props))
|
#(component-will-unmount props))
|
||||||
[max-height]))
|
[max-height]))
|
||||||
|
|
Loading…
Reference in New Issue