Skip to content

Commit

Permalink
Test approach
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil committed Oct 17, 2023
1 parent 56764b1 commit 95ab204
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 42 deletions.
49 changes: 27 additions & 22 deletions src/status_im2/contexts/chat/messages/list/view.cljs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
(ns status-im2.contexts.chat.messages.list.view
(:require
[oops.core :as oops]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[quo2.theme :as quo.theme]
[react-native.background-timer :as background-timer]
[react-native.core :as rn]
[react-native.hooks :as hooks]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[status-im.ui.screens.chat.group :as chat.group]
[status-im.ui.screens.chat.message.gap :as message.gap]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.constants :as composer.constants]
[status-im2.contexts.chat.messages.content.view :as message]
[status-im2.contexts.chat.messages.list.state :as state]
[status-im2.contexts.chat.messages.list.style :as style]
[status-im2.contexts.chat.messages.navigation.style :as navigation.style]
[status-im2.contexts.shell.jump-to.constants :as jump-to.constants]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
[oops.core :as oops]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[quo2.theme :as quo.theme]
[react-native.background-timer :as background-timer]
[react-native.core :as rn]
[react-native.hooks :as hooks]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[status-im.ui.screens.chat.group :as chat.group]
[status-im.ui.screens.chat.message.gap :as message.gap]
[status-im2.constants :as constants]
[status-im2.contexts.chat.composer.constants :as composer.constants]
[status-im2.contexts.chat.messages.content.view :as message]
[status-im2.contexts.chat.messages.list.state :as state]
[status-im2.contexts.chat.messages.list.style :as style]
[status-im2.contexts.chat.messages.navigation.style :as navigation.style]
[status-im2.contexts.shell.jump-to.constants :as jump-to.constants]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defonce ^:const threshold-percentage-to-show-floating-scroll-down-button 75)
(defonce ^:const loading-indicator-extra-spacing 250)
Expand Down Expand Up @@ -277,7 +277,7 @@
(reanimated/set-shared-value scroll-y (- content-size-y current-y))))

(defn f-messages-list-content
[{:keys [chat insets scroll-y content-height cover-bg-color keyboard-shown? inner-state-atoms]}]
[{:keys [chat insets scroll-y content-height cover-bg-color keyboard-shown? inner-state-atoms *animate-topbar-name]}]
(let [theme (quo.theme/use-theme-value)
{window-height :height} (rn/get-window)
{:keys [keyboard-height]} (hooks/use-keyboard)
Expand Down Expand Up @@ -367,7 +367,12 @@
"nativeEvent.layout.height")]
(reset! messages-view-height layout-height)))
:scroll-enabled (not recording?)
:content-inset-adjustment-behavior :never}]]))
:content-inset-adjustment-behavior :never
:on-scroll-end-drag (fn [] (if (and (< 135 (reanimated/get-shared-value scroll-y))
(> 180 (reanimated/get-shared-value scroll-y)))
(do (reset! *animate-topbar-name true)
(reanimated/animate scroll-y 179))
(reset! *animate-topbar-name false)))}]]))

(defn message-list-content-view
[props]
Expand Down
18 changes: 14 additions & 4 deletions src/status_im2/contexts/chat/messages/navigation/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

(defn f-view
[{:keys [theme scroll-y chat chat-screen-loaded? all-loaded? display-name online? photo-path
back-icon]}]
back-icon *animate-topbar-name]}]
(let [{:keys [group-chat chat-id]} chat
opacity-animation (reanimated/interpolate scroll-y
[50
Expand All @@ -32,13 +32,23 @@
{:extrapolateLeft "clamp"
:extrapolateRight "extend"})
translate-animation (reanimated/interpolate scroll-y
[(- style/navigation-bar-height 20)
(+ style/navigation-bar-height 100)]
[(if @*animate-topbar-name
175
(- style/navigation-bar-height 20))
(if @*animate-topbar-name
180
(+ style/navigation-bar-height 100))]
[50 0]
{:extrapolateLeft "clamp"
:extrapolateRight "clamp"})
_ (prn @*animate-topbar-name (reanimated/get-shared-value scroll-y))
title-opacity-animation (reanimated/interpolate scroll-y
[130 180]
[(if @*animate-topbar-name
(- 60 (reanimated/get-shared-value scroll-y))
130)
(if @*animate-topbar-name
(+ (reanimated/get-shared-value scroll-y) 40)
180)]
[0 1]
{:extrapolateLeft "clamp"
:extrapolateRight "clamp"})]
Expand Down
35 changes: 19 additions & 16 deletions src/status_im2/contexts/chat/messages/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
(let [insets (safe-area/get-insets)
scroll-y (reanimated/use-shared-value 0)
content-height (reanimated/use-shared-value 0)
*animate-topbar-name (reagent/atom false)
{:keys [keyboard-height keyboard-shown]} (hooks/use-keyboard)
{:keys [chat-id
contact-request-state
Expand Down Expand Up @@ -64,23 +65,25 @@
:keyboard-vertical-offset (- (:bottom insets))}

[list.view/message-list-content-view
{:chat chat
:insets insets
:scroll-y scroll-y
:content-height content-height
:cover-bg-color :turquoise
:keyboard-shown? keyboard-shown
:inner-state-atoms inner-state-atoms}]

{:chat chat
:insets insets
:scroll-y scroll-y
:content-height content-height
:cover-bg-color :turquoise
:keyboard-shown? keyboard-shown
:inner-state-atoms inner-state-atoms
:*animate-topbar-name *animate-topbar-name}]

[messages.navigation/navigation-view
{:scroll-y scroll-y
:back-icon back-icon
:chat chat
:chat-screen-loaded? chat-screen-loaded?
:all-loaded? all-loaded?
:display-name display-name
:online? online?
:photo-path photo-path}]
{:scroll-y scroll-y
:*animate-topbar-name *animate-topbar-name
:back-icon back-icon
:chat chat
:chat-screen-loaded? chat-screen-loaded?
:all-loaded? all-loaded?
:display-name display-name
:online? online?
:photo-path photo-path}]

(if able-to-send-message?
[:f> composer.view/composer
Expand Down

0 comments on commit 95ab204

Please sign in to comment.