tabs bar UI refresh

This commit is contained in:
Gustavo Nunes 2017-03-07 20:06:15 -03:00 committed by Roman Volosovskyi
parent 810fe76c7c
commit 990f9fcbf5
75 changed files with 219 additions and 210 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "universal",
"filename" : "icon_tab_chats.png",
"filename" : "icon_chats.png",
"scale" : "1x"
},
{
@ -18,4 +18,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_chats_active.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "universal",
"filename" : "icon_tab_contacts.png",
"filename" : "icon_contacts.png",
"scale" : "1x"
},
{
@ -18,4 +18,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_contacts_active.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "universal",
"filename" : "icon_tab_discover.png",
"filename" : "icon_discover.png",
"scale" : "1x"
},
{
@ -18,4 +18,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_discover_active.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -89,9 +89,10 @@
[view st/chat-separator-item]]))))
(defview chats-list []
[chats [:filtered-chats]
edit? [:get-in [:chat-list-ui-props :edit?]]
search? [:get-in [:toolbar-search :show]]]
[chats [:filtered-chats]
edit? [:get-in [:chat-list-ui-props :edit?]]
search? [:get-in [:toolbar-search :show]]
tabs-hidden? [:tabs-hidden?]]
[view st/chats-container
(cond
edit? [toolbar-edit]
@ -104,7 +105,7 @@
:renderFooter #(when (seq chats) (list-item [chat-shadow-item]))
:renderSeparator (when (get-in platform-specific [:chats :render-separator?])
(render-separator-fn chats))
:style st/list-container}]
:style (st/list-container tabs-hidden?)}]
(when (and (not edit?)
(not search?)
(get-in platform-specific [:chats :action-button?]))

View File

@ -1,4 +1,5 @@
(ns status-im.chats-list.styles
(:require-macros [status-im.utils.styles :refer [defnstyle]])
(:require [status-im.components.styles :refer [color-white
color-light-gray
color-blue
@ -8,7 +9,7 @@
text4-color
separator-color
new-messages-count-color]]
[status-im.components.tabs.styles :refer [tabs-height]]
[status-im.components.tabs.styles :as tabs-st]
[status-im.components.toolbar.styles :refer [toolbar-background1
toolbar-background2]]
[status-im.utils.platform :as p]))
@ -99,10 +100,10 @@
:height 16})
(def last-message-container
{:flex-shrink 1})
{:flex-shrink 1})
(def last-message-text
(merge {:color text4-color}
(merge {:color text4-color}
(get-in p/platform-specific [:component-styles :chat-list :last-message])))
(def status-container
@ -136,9 +137,12 @@
(def chats-container
{:flex 1})
(def list-container
(merge (get-in p/platform-specific [:component-styles :main-tab-list])
(get-in p/platform-specific [:component-styles :chat-list :list-container])))
(defnstyle list-container [tabs-hidden?]
{:android {:background-color color-light-gray
:margin-bottom 20}
:ios {:background-color color-white
:margin-bottom (if tabs-hidden? 20 (+ 16 tabs-st/tabs-height))}})
(def toolbar-actions
{:flex-direction :row

View File

@ -4,16 +4,9 @@
[cljs.core.async.macros :as am])
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[reagent.core :as r]
[status-im.components.react :refer [view
animated-view
text
image
touchable-highlight
get-dimensions
swiper]]
[status-im.components.react :refer [view swiper]]
[status-im.components.status-bar :refer [status-bar]]
[status-im.components.drawer.view :refer [drawer-view]]
[status-im.components.animation :as anim]
[status-im.components.tabs.bottom-shadow :refer [bottom-shadow-view]]
[status-im.chats-list.screen :refer [chats-list]]
[status-im.discover.screen :refer [discover]]
@ -25,37 +18,24 @@
[cljs.core.async :as a]))
(def tab-list
[{:view-id :chat-list
:title (label :t/chats)
:screen chats-list
:icon :icon_tab_chats
:index 0}
{:view-id :discover
:title (label :t/discover)
:screen discover
:icon :icon_tab_discover
:index 1}
{:view-id :contact-list
:title (label :t/contacts)
:screen contact-list
:icon :icon_tab_contacts
:index 2}])
(defn animation-logic [{:keys [offsets val tab-id to-tab-id]}]
(fn [_]
(when-let [offsets @offsets]
(let [from-value (:from offsets)
to-value (:to offsets)
to-tab-id @to-tab-id]
(anim/set-value val from-value)
(when to-value
(anim/start
(anim/timing val {:toValue to-value
:duration 300})
(when (= tab-id to-tab-id)
(fn [arg]
(when (.-finished arg)
(dispatch [:on-navigated-to-tab]))))))))))
[{:view-id :chat-list
:title (label :t/chats)
:screen chats-list
:icon-inactive :icon_chats
:icon-active :icon_chats_active
:index 0}
{:view-id :discover
:title (label :t/discover)
:screen discover
:icon-inactive :icon_discover
:icon-active :icon_discover_active
:index 1}
{:view-id :contact-list
:title (label :t/contacts)
:screen contact-list
:icon-inactive :icon_contacts
:icon-active :icon_contacts_active
:index 2}])
(def tab->index {:chat-list 0
:discover 1
@ -96,12 +76,14 @@
(recur (a/<! scroll-start))))
(defn main-tabs []
(let [view-id (subscribe [:get :view-id])
prev-view-id (subscribe [:get :prev-view-id])
main-swiper (r/atom nil)
swiped? (r/atom false)
scroll-start (a/chan 10)
scroll-ended (a/chan 10)]
(let [view-id (subscribe [:get :view-id])
prev-view-id (subscribe [:get :prev-view-id])
tabs-hidden? (subscribe [:tabs-hidden?])
main-swiper (r/atom nil)
swiped? (r/atom false)
scroll-start (a/chan 10)
scroll-ended (a/chan 10)
tabs-were-hidden? (atom @tabs-hidden?)]
(r/create-class
{:component-did-mount
#(start-scrolling-loop scroll-start scroll-ended)
@ -109,9 +91,10 @@
(fn []
(if @swiped?
(reset! swiped? false)
(when @main-swiper
(when (and (= @tabs-were-hidden? @tabs-hidden?) @main-swiper)
(let [to (scroll-to @prev-view-id @view-id)]
(a/put! scroll-start [@main-swiper to])))))
(a/put! scroll-start [@main-swiper to]))))
(reset! tabs-were-hidden? @tabs-hidden?))
:reagent-render
(fn []
[view common-st/flex
@ -120,7 +103,7 @@
[drawer-view
[view {:style common-st/flex}
[swiper (merge
st/main-swiper
(st/main-swiper @tabs-hidden?)
{:index (get-tab-index @view-id)
:loop false
:ref #(reset! main-swiper %)
@ -131,4 +114,5 @@
[tabs {:selected-view-id @view-id
:prev-view-id @prev-view-id
:tab-list tab-list}]
[bottom-shadow-view]]]]])})))
(when-not @tabs-hidden?
[bottom-shadow-view])]]]])})))

View File

@ -4,9 +4,9 @@
[status-im.utils.platform :refer [platform-specific]]))
(defn bottom-shadow-view []
(if (get-in platform-specific [:tabs :tab-shadows?])
[linear-gradient {:locations [0 0.8 1]
(when (get-in platform-specific [:tabs :tab-shadows?])
[linear-gradient {:locations [0 0.98 1]
:colors ["rgba(24, 52, 76, 0)" "rgba(24, 52, 76, 0.085)" "rgba(24, 52, 76, 0.165)"]
:style (merge
st/bottom-gradient
(get-in platform-specific [:component-styles :bottom-gradient]))}]))
(get-in platform-specific [:component-styles :bottom-gradient]))}]))

View File

@ -1,7 +1,9 @@
(ns status-im.components.tabs.styles
(:require [status-im.components.styles :refer [color-white]]))
(:require [status-im.components.styles :as st]
[status-im.utils.platform :as p]))
(def tabs-height 56)
(def tabs-height (if p/ios? 62 56))
(def tab-height (dec tabs-height))
(def bottom-gradient
@ -12,12 +14,11 @@
(defn tabs-container [hidden?]
{:position :absolute
:bottom 0
:bottom (if hidden? (- tabs-height) 0)
:left 0
:right 0
:height tabs-height
:background-color color-white
:margin-bottom (if hidden? (- tabs-height) 0)
:background-color st/color-white
:transform [{:translateY 1}]})
(def tabs-container-line
@ -37,12 +38,12 @@
:justifyContent :center
:alignItems :center})
(def tab-title
{:font-size 12
(defn tab-title [active?]
{:font-size (if-not (or active? p/ios?) 12 14)
:height 16
:min-width 60
:text-align :center
:color "#6e93d8"})
:color (if active? st/color-light-blue st/color-gray4)})
(def tab-icon
{:width 24
@ -50,22 +51,16 @@
:marginBottom 1
:align-self :center})
(defn tab-container [active?]
(def tab-container
{:flex 1
:height tab-height
:justifyContent :center
:alignItems :center
:padding-top (if active? 0 16)})
:alignItems :center})
(defn animated-offset [value]
{:top value
:justifyContent :center
:alignItems :center})
(def main-swiper
(defn main-swiper [tabs-hidden?]
{:position :absolute
:top 0
:left 0
:right 0
:bottom tabs-height
:bottom (if tabs-hidden? 0 tabs-height)
:shows-pagination false})

View File

@ -1,58 +1,23 @@
(ns status-im.components.tabs.tab
(:require-macros [status-im.utils.views :refer [defview]])
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[status-im.components.react :refer [view
animated-view
text
image
touchable-highlight]]
[reagent.core :as r]
[status-im.components.tabs.styles :as st]
[status-im.components.animation :as anim]))
[status-im.utils.platform :as p]
[status-im.components.tabs.styles :as st]))
(defn animation-logic [val to-value]
(fn []
(anim/start (anim/spring val {:toValue to-value
:tension 40}))))
(defview tab [_]
(let [icon-anim-value (anim/create-value 0)
text-anim-value (anim/create-value 0)
icon-reverse-anim-value (anim/create-value 0)
text-reverse-anim-value (anim/create-value 0)
on-update (comp (animation-logic icon-anim-value 0)
(animation-logic text-anim-value 0)
(animation-logic icon-reverse-anim-value 0)
(animation-logic text-reverse-anim-value 30))]
(r/create-class
{:component-did-mount
on-update
:component-did-update
on-update
:component-will-receive-props
(fn []
(anim/set-value icon-anim-value 8)
(anim/set-value text-anim-value 30)
(anim/set-value icon-reverse-anim-value -8)
(anim/set-value text-reverse-anim-value -8))
:reagent-render
(fn [{:keys [view-id title icon selected-view-id prev-view-id]}]
[touchable-highlight {:style st/tab
:disabled (= view-id selected-view-id)
:onPress #(dispatch [:navigate-to-tab view-id])}
[view {:style (st/tab-container (= selected-view-id view-id))}
[animated-view {:style (st/animated-offset (cond
(= selected-view-id view-id) icon-anim-value
(= prev-view-id view-id) icon-reverse-anim-value
:else 0))}
[image {:source {:uri icon}
:style st/tab-icon}]]
[animated-view {:style (st/animated-offset (cond
(= selected-view-id view-id) text-anim-value
(= prev-view-id view-id) text-reverse-anim-value
:else 0))}
[text {:style st/tab-title}
(if (or (= selected-view-id view-id)
(= prev-view-id view-id))
title
" ")]]]])})))
(defn tab [{:keys [view-id title icon-active icon-inactive selected-view-id prev-view-id]}]
(let [active? (= view-id selected-view-id)
previous? (= view-id prev-view-id)]
[touchable-highlight {:style st/tab
:disabled active?
:onPress #(dispatch [:navigate-to-tab view-id])}
[view {:style st/tab-container}
[view
[image {:source {:uri (if active? icon-active icon-inactive)}
:style st/tab-icon}]]
[view
[text {:style (st/tab-title active?)
:font (if (and p/ios? active?) :medium :regular)}
title]]]]))

View File

@ -21,36 +21,13 @@
:prev-view-id prev-view-id})]
[tab data]))
(defn animation-logic [{:keys [hidden? val]}]
(let [was-hidden? (atom (not @hidden?))]
(fn [_]
(when (not= @was-hidden? @hidden?)
(let [to-value (if @hidden? 0 (- st/tabs-height))]
(swap! was-hidden? not)
(anim/start
(anim/timing val {:toValue to-value
:duration 300})))))))
(defn tabs-container [& _]
(let [chats-scrolled? (subscribe [:get :chats-scrolled?])
tabs-bar-value (subscribe [:animations :tabs-bar-value])
shadows? (get-in platform-specific [:tabs :tab-shadows?])
context {:hidden? chats-scrolled?
:val @tabs-bar-value}
on-update (animation-logic context)]
(anim/set-value @tabs-bar-value 0)
(r/create-class
{:component-did-mount
on-update
:component-did-update
on-update
:reagent-render
(fn [& children]
@chats-scrolled?
(into [animated-view {:style (merge (st/tabs-container @chats-scrolled?)
(if-not shadows? st/tabs-container-line))
:pointerEvents (if @chats-scrolled? :none :auto)}]
children))})))
(defn tabs-container [& children]
(let [tabs-hidden? (subscribe [:tabs-hidden?])
shadows? (get-in platform-specific [:tabs :tab-shadows?])]
(into [animated-view {:style (merge (st/tabs-container @tabs-hidden?)
(if-not shadows? st/tabs-container-line))
:pointerEvents (if @tabs-hidden? :none :auto)}]
children)))
(defn tabs [{:keys [tab-list selected-view-id prev-view-id]}]
[tabs-container

View File

@ -1,5 +1,5 @@
(ns status-im.components.toolbar-new.styles
(:require-macros [status-im.utils.styles :refer [defnstyles]])
(:require-macros [status-im.utils.styles :refer [defnstyle]])
(:require [status-im.components.styles :refer [text1-color
color-white
color-light-gray
@ -25,7 +25,7 @@
(merge {:flex-direction :row}
(get-in p/platform-specific [:component-styles :toolbar-new])))
(defnstyles toolbar-nav-actions-container
(defnstyle toolbar-nav-actions-container
[actions]
{:flex-direction :row
:ios {:width (when (and actions (pos? (count actions)))

View File

@ -152,8 +152,9 @@
contacts-count [:added-contacts-count]
click-handler [:get :contacts-click-handler]
edit? [:get-in [:contacts-ui-props :edit?]]
groups [:all-added-groups]]
[view st/contacts-list-container
groups [:all-added-groups]
tabs-hidden? [:tabs-hidden?]]
[view (st/contacts-list-container tabs-hidden?)
(if edit?
[toolbar-edit]
[toolbar-view])

View File

@ -1,5 +1,5 @@
(ns status-im.contacts.styles
(:require-macros [status-im.utils.styles :refer [defstyles]])
(:require-macros [status-im.utils.styles :refer [defnstyle]])
(:require [status-im.components.styles :refer [text1-color
text2-color
text3-color
@ -11,6 +11,7 @@
color-light-red
color-gray]]
[status-im.components.toolbar.styles :refer [toolbar-background1 toolbar-background2]]
[status-im.components.tabs.styles :as tabs-st]
[status-im.utils.platform :as p]))
;; Contacts list
@ -22,10 +23,10 @@
{:flex 1
:background-color toolbar-background2})
(defstyles contacts-list-container
(defnstyle contacts-list-container [tabs-hidden?]
{:flex 1
:android {:margin-bottom 20}
:ios {:margin-bottom 72}})
:ios {:margin-bottom (if tabs-hidden? 20 (+ 16 tabs-st/tabs-height))}})
(def contacts-list
{:background-color color-white})
@ -137,8 +138,8 @@
(def info-container
(merge (get-in p/platform-specific [:component-styles :contacts :info-container])
{:flex 1
:flexDirection :column}))
{:flex 1
:flexDirection :column}))
(def name-text
(get-in p/platform-specific [:component-styles :contacts :name-text]))
@ -194,18 +195,18 @@
{:margin-right 42})
(def enter-address-icon
{:margin-left 21
:margin-right 21
:margin-top 19
:width 20
:height 18})
{:margin-left 21
:margin-right 21
:margin-top 19
:width 20
:height 18})
(def scan-qr-icon
{:margin-left 21
:margin-right 20
:margin-top 18
:width 20
:height 20})
{:margin-left 21
:margin-right 20
:margin-top 18
:width 20
:height 20})
;; Contacts search

View File

@ -42,7 +42,7 @@
:qr-codes {}
:keyboard-height 0
:animations {;; todo clear this
:tabs-bar-value (anim/create-value 0)}
}
:loading-allowed true
:sync-state :done

View File

@ -78,12 +78,13 @@
search-text [:get-in [:toolbar-search :text]]
contacts [:get :contacts]
current-account [:get-current-account]
discoveries [:get-recent-discoveries]]
discoveries [:get-recent-discoveries]
tabs-hidden? [:tabs-hidden?]]
[view st/discover-container
[toolbar-view (and current-view?
(= show-search :discover)) search-text]
(if discoveries
[scroll-view {:style (get-in platform-specific [:component-styles :main-tab-list])}
[scroll-view (st/list-container tabs-hidden?)
[discover-popular {:contacts contacts
:current-account current-account}]
[discover-recent {:current-account current-account}]]

View File

@ -1,8 +1,11 @@
(ns status-im.discover.styles
(:require-macros [status-im.utils.styles :refer [defnstyle]])
(:require [status-im.components.styles :refer [color-white
color-light-gray
color-blue]]
[status-im.components.toolbar.styles :refer [toolbar-background2]]))
[status-im.components.toolbar.styles :refer [toolbar-background2]]
[status-im.components.tabs.styles :as tabs-st]
[status-im.utils.platform :as p]))
;; Common
@ -12,7 +15,7 @@
(def row
{:flex-direction :row
:margin-bottom 10})
:margin-bottom 10})
(def column
{:flex-direction :column})
@ -72,7 +75,7 @@
(def popular-list-item
{:flex-direction :row
:padding-bottom 16
:top 1})
:top 1})
(def popular-list-item-name
{:color "black"
@ -138,6 +141,10 @@
{:flex 1
:backgroundColor color-white})
(defnstyle list-container [tabs-hidden?]
{:android {:margin-bottom 20}
:ios {:margin-bottom (if tabs-hidden? 20 (+ 16 tabs-st/tabs-height))}})
(def search-icon
{:width 17
:height 17})

View File

@ -33,3 +33,13 @@
accounts (subscribe [:get :accounts])]
(reaction (when (and @accounts @account-id)
(get-in @accounts [@account-id :signed-up?]))))))
(register-sub :tabs-hidden?
(fn []
(let [search-mode? (subscribe [:get-in [:toolbar-search :show]])
chats-edit-mode? (subscribe [:get-in [:chat-list-ui-props :edit?]])
contacts-edit-mode? (subscribe [:get-in [:contacts-ui-props :edit?]])
view-id (subscribe [:get :view-id])]
(reaction (or @search-mode?
(and (= @view-id :chat-list) @chats-edit-mode?)
(and (= @view-id :contact-list) @contacts-edit-mode?))))))

View File

@ -1,51 +1,51 @@
(ns status-im.utils.styles)
(defn body [styles]
`(let [styles# ~styles
common# (dissoc styles# :android :ios)
(defn body [style]
`(let [style# ~style
common# (dissoc style# :android :ios)
platform# (keyword status-im.utils.platform/platform)
platform-specific# (get styles# platform#)]
platform-specific# (get style# platform#)]
(if platform-specific#
(merge common# platform-specific#)
common#)))
(defmacro defstyles
"Defines styles symbol.
Styles parameter may contain plaform specific styles:
(defmacro defstyle
"Defines style symbol.
Style parameter may contain plaform specific style:
{:width 100
:height 125
:ios {:height 20}
:android {:margin-top 3}}
Reuslting styles for Android:
Reuslting style for Android:
{:width 100
:height 125
:margin-top 3}
Resulting styles for iOS:
Resulting style for iOS:
{:width 100
:height 20}"
[style-name styles]
[style-name style]
`(def ~style-name
~(body styles)))
~(body style)))
(defmacro defnstyles
"Defines styles function.
Styles parameter may contain plaform specific styles:
(defmacro defnstyle
"Defines style function.
Style parameter may contain plaform specific style:
{:width 100
:height (* a 2)
:ios {:height (/ a 2)}
:android {:margin-top 3}}
Resulting styles for Android (with (= a 10)):
Resulting style for Android (with (= a 10)):
{:width 100
:height 20
:margin-top 3}
Resulting styles for iOS (with (= a 10)):
Resulting style for iOS (with (= a 10)):
{:width 100
:height 5}"
[style-name params styles]
[style-name params style]
`(defn ~style-name
[~@params]
~(body styles)))
~(body style)))