Returning expandable animations back, removing :get-max-container-area-height
This commit is contained in:
parent
4fa9459e40
commit
5280f3d9a0
|
@ -115,7 +115,8 @@ function amountParameterBox(groupChat, params, context) {
|
||||||
showBack: true,
|
showBack: true,
|
||||||
markup: status.components.scrollView(
|
markup: status.components.scrollView(
|
||||||
{
|
{
|
||||||
keyboardShouldPersistTaps: "always"
|
keyboardShouldPersistTaps: "always",
|
||||||
|
bounces: false,
|
||||||
},
|
},
|
||||||
[status.components.view(
|
[status.components.view(
|
||||||
{
|
{
|
||||||
|
|
|
@ -319,15 +319,6 @@
|
||||||
(let [bottom (+ input-height chat-input-margin)]
|
(let [bottom (+ input-height chat-input-margin)]
|
||||||
(input-utils/default-container-area-height bottom layout-height))))
|
(input-utils/default-container-area-height bottom layout-height))))
|
||||||
|
|
||||||
(reg-sub
|
|
||||||
:get-max-container-area-height
|
|
||||||
:<- [:get-current-chat-ui-prop :input-height]
|
|
||||||
:<- [:get :layout-height]
|
|
||||||
:<- [:chat-input-margin]
|
|
||||||
(fn [[input-height layout-height chat-input-margin]]
|
|
||||||
(let [bottom (+ input-height chat-input-margin)]
|
|
||||||
(input-utils/max-container-area-height bottom layout-height))))
|
|
||||||
|
|
||||||
(reg-sub
|
(reg-sub
|
||||||
:chat-animations
|
:chat-animations
|
||||||
(fn [db [_ key type]]
|
(fn [db [_ key type]]
|
||||||
|
|
|
@ -3,30 +3,13 @@
|
||||||
(:require [reagent.core :as reagent]
|
(:require [reagent.core :as reagent]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.ui.components.animation :as animation]
|
[status-im.ui.components.animation :as animation]
|
||||||
[status-im.ui.components.drag-drop :as drag]
|
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.chat.views.input.animations.responder :as responder]
|
[status-im.chat.views.input.animations.responder :as responder]
|
||||||
[status-im.chat.views.input.utils :as input-utils]
|
[status-im.chat.views.input.utils :as input-utils]
|
||||||
[status-im.chat.styles.animations :as style]
|
[status-im.chat.styles.animations :as style]
|
||||||
[status-im.chat.styles.input.input :as input-style]))
|
[status-im.chat.styles.input.input :as input-style]))
|
||||||
|
|
||||||
(defn header [key container-height custom-header]
|
(defn expandable-view-on-update [{:keys [anim-value to-changed-height chat-input-margin height]}]
|
||||||
(let [set-container-height (re-frame/subscribe [:chat-animations key :height])
|
|
||||||
max-container-height (re-frame/subscribe [:get-max-container-area-height])
|
|
||||||
pan-responder (responder/pan-responder container-height
|
|
||||||
max-container-height
|
|
||||||
:fix-expandable-height
|
|
||||||
key)]
|
|
||||||
(fn [_]
|
|
||||||
[react/view (merge (drag/pan-handlers pan-responder)
|
|
||||||
{:style style/header-container})
|
|
||||||
[react/view style/header-icon]
|
|
||||||
(when (and custom-header
|
|
||||||
(or (= @set-container-height :max)
|
|
||||||
(> @set-container-height (:min-height style/header-container))))
|
|
||||||
[custom-header])])))
|
|
||||||
|
|
||||||
(defn expandable-view-on-update [{:keys [anim-value to-changed-height max-height chat-input-margin height]}]
|
|
||||||
(let [to-default-height (re-frame/subscribe [:get-default-container-area-height])
|
(let [to-default-height (re-frame/subscribe [:get-default-container-area-height])
|
||||||
layout-height (re-frame/subscribe [:get :layout-height])]
|
layout-height (re-frame/subscribe [:get :layout-height])]
|
||||||
(fn [component]
|
(fn [component]
|
||||||
|
@ -42,8 +25,7 @@
|
||||||
to-change-height (if (= to-changed-height :max)
|
to-change-height (if (= to-changed-height :max)
|
||||||
(input-utils/max-container-area-height @chat-input-margin @layout-height)
|
(input-utils/max-container-area-height @chat-input-margin @layout-height)
|
||||||
to-changed-height)
|
to-changed-height)
|
||||||
to-value (min (or to-change-height (or height @to-default-height))
|
to-value (or to-change-height (or height @to-default-height))]
|
||||||
@max-height)]
|
|
||||||
(re-frame/dispatch [:set :expandable-view-height-to-value to-value])
|
(re-frame/dispatch [:set :expandable-view-height-to-value to-value])
|
||||||
(animation/start
|
(animation/start
|
||||||
(animation/spring anim-value {:toValue to-value
|
(animation/spring anim-value {:toValue to-value
|
||||||
|
@ -53,14 +35,12 @@
|
||||||
(defn expandable-view [{:keys [key height hide-overlay?]} & _]
|
(defn expandable-view [{:keys [key height hide-overlay?]} & _]
|
||||||
(let [anim-value (animation/create-value 0)
|
(let [anim-value (animation/create-value 0)
|
||||||
input-height (re-frame/subscribe [:get-current-chat-ui-prop :input-height])
|
input-height (re-frame/subscribe [:get-current-chat-ui-prop :input-height])
|
||||||
max-height (re-frame/subscribe [:get-max-container-area-height])
|
|
||||||
fullscreen? (re-frame/subscribe [:get-current-chat-ui-prop :fullscreen?])
|
fullscreen? (re-frame/subscribe [:get-current-chat-ui-prop :fullscreen?])
|
||||||
chat-input-margin (re-frame/subscribe [:chat-input-margin])
|
chat-input-margin (re-frame/subscribe [:chat-input-margin])
|
||||||
to-changed-height (re-frame/subscribe [:chat-animations key :height])
|
to-changed-height (re-frame/subscribe [:chat-animations key :height])
|
||||||
changes-counter (re-frame/subscribe [:chat-animations key :changes-counter])
|
changes-counter (re-frame/subscribe [:chat-animations key :changes-counter])
|
||||||
on-update (expandable-view-on-update {:anim-value anim-value
|
on-update (expandable-view-on-update {:anim-value anim-value
|
||||||
:to-changed-height to-changed-height
|
:to-changed-height to-changed-height
|
||||||
:max-height max-height
|
|
||||||
:chat-input-margin chat-input-margin
|
:chat-input-margin chat-input-margin
|
||||||
:height height})]
|
:height height})]
|
||||||
(reagent/create-class
|
(reagent/create-class
|
||||||
|
@ -77,17 +57,13 @@
|
||||||
:display-name
|
:display-name
|
||||||
"expandable-view"
|
"expandable-view"
|
||||||
:reagent-render
|
:reagent-render
|
||||||
(fn [{:keys [draggable? custom-header]} & elements]
|
(fn [{:keys [custom-header]} & elements]
|
||||||
@to-changed-height @changes-counter @max-height
|
@to-changed-height @changes-counter
|
||||||
(let [input-height (or @input-height (+ input-style/padding-vertical
|
(let [input-height (or @input-height (+ input-style/padding-vertical
|
||||||
input-style/min-input-height
|
input-style/min-input-height
|
||||||
input-style/padding-vertical
|
input-style/padding-vertical
|
||||||
input-style/border-height))
|
input-style/border-height))
|
||||||
bottom (+ input-height @chat-input-margin)
|
bottom (+ input-height @chat-input-margin)]
|
||||||
height (if @fullscreen? @max-height anim-value)]
|
|
||||||
[react/view style/overlap-container
|
[react/view style/overlap-container
|
||||||
(into [react/animated-view {:style (style/expandable-container height bottom)}
|
(into [react/animated-view {:style (style/expandable-container anim-value bottom)}]
|
||||||
(when (and draggable?
|
|
||||||
(not @fullscreen?))
|
|
||||||
[header key anim-value custom-header])]
|
|
||||||
elements)]))})))
|
elements)]))})))
|
||||||
|
|
Loading…
Reference in New Issue