Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull committed Feb 23, 2024
1 parent 68b580c commit cf2de01
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
8 changes: 8 additions & 0 deletions src/js/worklets/chat/messenger/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ export function jumpToButtonPosition(scrollDownButtonOpacity, isComposerFocused)
});
}

export function containerOpacity(isComposerFocused, isEmptyInput, emptyOpacity) {
return useDerivedValue(function () {
'worklet';
console.log("-----------", isEmptyInput.value, isComposerFocused.value, emptyOpacity);
return isEmptyInput.value && !isComposerFocused.value ? emptyOpacity : 1;
});
}

export function blurContainerElevation(containerOpacity) {
return useDerivedValue(function () {
'worklet';
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/contexts/chat/messenger/composer/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
:shadow-offset {:width 0 :height (colors/theme-colors -4 -8 theme)}}))

(defn sheet-container
[insets {:keys [container-opacity composer-elevation]} theme]
[insets {:keys [container-opacity2 composer-elevation]} theme]
(reanimated/apply-animations-to-style
{:opacity container-opacity
{:opacity container-opacity2
:elevation composer-elevation}
(merge
{:border-top-left-radius border-top-radius
Expand Down
29 changes: 12 additions & 17 deletions src/status_im/contexts/chat/messenger/composer/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,16 @@

(defn shared-values
[]
(let [input-container-height (reanimated/use-shared-value 0)]
{:composer-focused? (reanimated/use-shared-value false)
(let [input-container-height (reanimated/use-shared-value 0)
composer-focused? (reanimated/use-shared-value false)
empty-input? (reanimated/use-shared-value true)
container-opacity (worklets/container-opacity composer-focused? empty-input? constants/empty-opacity)]
{:composer-focused? composer-focused?
:container-opacity2 container-opacity
:container-opacity (reanimated/use-shared-value 1) ;; TODO - remove this one
:height input-container-height
:blur-container-elevation (worklets/blur-container-elevation container-opacity)
:composer-elevation (worklets/composer-elevation container-opacity)
:empty-input? (reanimated/use-shared-value false)
:background-overlay-opacity (worklets/background-overlay-opacity input-container-height)}))

Expand All @@ -215,23 +222,11 @@
(let [initial-height (if (> lines 1)
constants/multiline-minimized-height
constants/input-height)
input-container-height (:height shared-values)
container-opacity (reanimated/use-shared-value
(if (empty-input?
input-text
images
link-previews?
reply
audio)
0.7
1))]
(when (= (reanimated/get-shared-value input-container-height) 0)
(reanimated/set-shared-value input-container-height initial-height))
input-container-height (:height shared-values)]
;; (when (= (reanimated/get-shared-value input-container-height) 0)
;; (reanimated/set-shared-value input-container-height initial-height))
(assoc shared-values
:gradient-opacity (reanimated/use-shared-value 0)
:container-opacity container-opacity
:blur-container-elevation (worklets/blur-container-elevation container-opacity)
:composer-elevation (worklets/composer-elevation container-opacity)
:saved-height (reanimated/use-shared-value
initial-height)
:last-height (reanimated/use-shared-value
Expand Down
4 changes: 4 additions & 0 deletions src/utils/worklets/chat/messenger/composer.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
[scroll-down-button-opacity-sv composer-focused?]
(.jumpToButtonPosition ^js worklets scroll-down-button-opacity-sv composer-focused?))

(defn container-opacity
[composer-focused? empty-input? empty-opacity]
(.containerOpacity ^js worklets composer-focused? empty-input? empty-opacity))

(defn blur-container-elevation
[container-opacity]
(.blurContainerElevation ^js worklets container-opacity))
Expand Down

0 comments on commit cf2de01

Please sign in to comment.