Fix for "Rendered more hooks than during the previous render" error on closing group chat/communty channel (#16145)

* "Rendered more hooks than during the previous render" error on closing group chat/communty channel

* Lint fix
This commit is contained in:
Alexander 2023-06-02 14:49:46 +01:00 committed by GitHub
parent c5166ac48e
commit 39ea12cf29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,6 +138,34 @@
spacing-between-composer-and-content
(when platform/ios? style/overscroll-cover-height))}])
(defn f-list-footer-avatar
[{:keys [scroll-y display-name online? photo-path]}]
(let [image-scale-animation (reanimated/interpolate scroll-y
scroll-animation-input-range
[1 0.5]
header-extrapolation-option)
image-top-margin-animation (reanimated/interpolate scroll-y
scroll-animation-input-range
[0 40]
header-extrapolation-option)
image-side-margin-animation (reanimated/interpolate scroll-y
scroll-animation-input-range
[0 -20]
header-extrapolation-option)]
[reanimated/view
{:style (style/header-image image-scale-animation
image-top-margin-animation
image-side-margin-animation)}
[quo/user-avatar
{:full-name display-name
:online? online?
:profile-picture photo-path
:size :big}]]))
(defn list-footer-avatar
[props]
[:f> f-list-footer-avatar props])
(defn f-list-footer
[{:keys [chat scroll-y cover-bg-color on-layout]}]
(let [{:keys [chat-id chat-name emoji chat-type
@ -155,18 +183,6 @@
border-animation (reanimated/interpolate scroll-y
[30 125]
[14 0]
header-extrapolation-option)
image-scale-animation (reanimated/interpolate scroll-y
scroll-animation-input-range
[1 0.5]
header-extrapolation-option)
image-top-margin-animation (reanimated/interpolate scroll-y
scroll-animation-input-range
[0 40]
header-extrapolation-option)
image-side-margin-animation (reanimated/interpolate scroll-y
scroll-animation-input-range
[0 -20]
header-extrapolation-option)]
[rn/view {:flex 1}
[rn/view
@ -176,17 +192,13 @@
[rn/view {:style (style/header-cover cover-bg-color)}])
[reanimated/view {:style (style/header-bottom-part border-animation)}
[rn/view {:style style/header-avatar}
(when-not group-chat
[rn/view {:style {:align-items :flex-start}}
[reanimated/view
{:style (style/header-image image-scale-animation
image-top-margin-animation
image-side-margin-animation)}
[quo/user-avatar
{:full-name display-name
(when-not group-chat
[list-footer-avatar
{:scroll-y scroll-y
:display-name display-name
:online? online?
:profile-picture photo-path
:size :big}]]])
:profile-picture photo-path}])]
[rn/view {:style style/name-container}
[quo/text
{:weight :semi-bold