[fix 7617] search bar glitch

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
yenda 2019-03-04 14:42:19 +01:00 committed by Pedro Pombeiro
parent 3584b31747
commit 9634a8ae1b
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
1 changed files with 12 additions and 2 deletions

View File

@ -156,12 +156,22 @@
:easing (.in (animation/easing)
(.-quad (animation/easing)))})))
(defn set-search-state-visible!
[visible?]
(swap! search-input-state assoc :show? visible?)
(animation/set-value (:height @search-input-state)
(if visible?
styles/search-input-height
0)))
(defn animated-search-input
[search-filter]
(reagent/create-class
{:component-will-unmount
#(do (swap! search-input-state assoc :show? false)
(animation/set-value (:height @search-input-state) 0))
#(set-search-state-visible! false)
:component-did-mount
#(when search-filter
(set-search-state-visible! true))
:reagent-render
(fn [search-filter]
(let [{:keys [show? height]} @search-input-state]