tabs bar UI refresh
After Width: | Height: | Size: 765 B |
After Width: | Height: | Size: 776 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 792 B |
Before Width: | Height: | Size: 891 B |
After Width: | Height: | Size: 419 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 720 B |
After Width: | Height: | Size: 755 B |
After Width: | Height: | Size: 753 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 504 B |
Before Width: | Height: | Size: 617 B |
After Width: | Height: | Size: 737 B |
After Width: | Height: | Size: 742 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 435 B |
Before Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.0 KiB |
|
@ -2,7 +2,7 @@
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "icon_tab_chats.png",
|
"filename" : "icon_chats.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
BIN
ios/StatusIm/Images.xcassets/icon_chats_active.imageset/icon_chats_active.png
vendored
Normal file
After Width: | Height: | Size: 1.5 KiB |
|
@ -2,7 +2,7 @@
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "icon_tab_contacts.png",
|
"filename" : "icon_contacts.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
BIN
ios/StatusIm/Images.xcassets/icon_contacts_active.imageset/icon_contacts_active.png
vendored
Normal file
After Width: | Height: | Size: 2.6 KiB |
|
@ -2,7 +2,7 @@
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "icon_tab_discover.png",
|
"filename" : "icon_discover.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
After Width: | Height: | Size: 3.2 KiB |
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
BIN
ios/StatusIm/Images.xcassets/icon_discover_active.imageset/icon_discover_active.png
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
|
@ -91,7 +91,8 @@
|
||||||
(defview chats-list []
|
(defview chats-list []
|
||||||
[chats [:filtered-chats]
|
[chats [:filtered-chats]
|
||||||
edit? [:get-in [:chat-list-ui-props :edit?]]
|
edit? [:get-in [:chat-list-ui-props :edit?]]
|
||||||
search? [:get-in [:toolbar-search :show]]]
|
search? [:get-in [:toolbar-search :show]]
|
||||||
|
tabs-hidden? [:tabs-hidden?]]
|
||||||
[view st/chats-container
|
[view st/chats-container
|
||||||
(cond
|
(cond
|
||||||
edit? [toolbar-edit]
|
edit? [toolbar-edit]
|
||||||
|
@ -104,7 +105,7 @@
|
||||||
:renderFooter #(when (seq chats) (list-item [chat-shadow-item]))
|
:renderFooter #(when (seq chats) (list-item [chat-shadow-item]))
|
||||||
:renderSeparator (when (get-in platform-specific [:chats :render-separator?])
|
:renderSeparator (when (get-in platform-specific [:chats :render-separator?])
|
||||||
(render-separator-fn chats))
|
(render-separator-fn chats))
|
||||||
:style st/list-container}]
|
:style (st/list-container tabs-hidden?)}]
|
||||||
(when (and (not edit?)
|
(when (and (not edit?)
|
||||||
(not search?)
|
(not search?)
|
||||||
(get-in platform-specific [:chats :action-button?]))
|
(get-in platform-specific [:chats :action-button?]))
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
(ns status-im.chats-list.styles
|
(ns status-im.chats-list.styles
|
||||||
|
(:require-macros [status-im.utils.styles :refer [defnstyle]])
|
||||||
(:require [status-im.components.styles :refer [color-white
|
(:require [status-im.components.styles :refer [color-white
|
||||||
color-light-gray
|
color-light-gray
|
||||||
color-blue
|
color-blue
|
||||||
|
@ -8,7 +9,7 @@
|
||||||
text4-color
|
text4-color
|
||||||
separator-color
|
separator-color
|
||||||
new-messages-count-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
|
[status-im.components.toolbar.styles :refer [toolbar-background1
|
||||||
toolbar-background2]]
|
toolbar-background2]]
|
||||||
[status-im.utils.platform :as p]))
|
[status-im.utils.platform :as p]))
|
||||||
|
@ -136,9 +137,12 @@
|
||||||
(def chats-container
|
(def chats-container
|
||||||
{:flex 1})
|
{:flex 1})
|
||||||
|
|
||||||
(def list-container
|
(defnstyle list-container [tabs-hidden?]
|
||||||
(merge (get-in p/platform-specific [:component-styles :main-tab-list])
|
{:android {:background-color color-light-gray
|
||||||
(get-in p/platform-specific [:component-styles :chat-list :list-container])))
|
:margin-bottom 20}
|
||||||
|
|
||||||
|
:ios {:background-color color-white
|
||||||
|
:margin-bottom (if tabs-hidden? 20 (+ 16 tabs-st/tabs-height))}})
|
||||||
|
|
||||||
(def toolbar-actions
|
(def toolbar-actions
|
||||||
{:flex-direction :row
|
{:flex-direction :row
|
||||||
|
|
|
@ -4,16 +4,9 @@
|
||||||
[cljs.core.async.macros :as am])
|
[cljs.core.async.macros :as am])
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[reagent.core :as r]
|
[reagent.core :as r]
|
||||||
[status-im.components.react :refer [view
|
[status-im.components.react :refer [view swiper]]
|
||||||
animated-view
|
|
||||||
text
|
|
||||||
image
|
|
||||||
touchable-highlight
|
|
||||||
get-dimensions
|
|
||||||
swiper]]
|
|
||||||
[status-im.components.status-bar :refer [status-bar]]
|
[status-im.components.status-bar :refer [status-bar]]
|
||||||
[status-im.components.drawer.view :refer [drawer-view]]
|
[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.components.tabs.bottom-shadow :refer [bottom-shadow-view]]
|
||||||
[status-im.chats-list.screen :refer [chats-list]]
|
[status-im.chats-list.screen :refer [chats-list]]
|
||||||
[status-im.discover.screen :refer [discover]]
|
[status-im.discover.screen :refer [discover]]
|
||||||
|
@ -28,35 +21,22 @@
|
||||||
[{:view-id :chat-list
|
[{:view-id :chat-list
|
||||||
:title (label :t/chats)
|
:title (label :t/chats)
|
||||||
:screen chats-list
|
:screen chats-list
|
||||||
:icon :icon_tab_chats
|
:icon-inactive :icon_chats
|
||||||
|
:icon-active :icon_chats_active
|
||||||
:index 0}
|
:index 0}
|
||||||
{:view-id :discover
|
{:view-id :discover
|
||||||
:title (label :t/discover)
|
:title (label :t/discover)
|
||||||
:screen discover
|
:screen discover
|
||||||
:icon :icon_tab_discover
|
:icon-inactive :icon_discover
|
||||||
|
:icon-active :icon_discover_active
|
||||||
:index 1}
|
:index 1}
|
||||||
{:view-id :contact-list
|
{:view-id :contact-list
|
||||||
:title (label :t/contacts)
|
:title (label :t/contacts)
|
||||||
:screen contact-list
|
:screen contact-list
|
||||||
:icon :icon_tab_contacts
|
:icon-inactive :icon_contacts
|
||||||
|
:icon-active :icon_contacts_active
|
||||||
:index 2}])
|
: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]))))))))))
|
|
||||||
|
|
||||||
(def tab->index {:chat-list 0
|
(def tab->index {:chat-list 0
|
||||||
:discover 1
|
:discover 1
|
||||||
:contact-list 2})
|
:contact-list 2})
|
||||||
|
@ -98,10 +78,12 @@
|
||||||
(defn main-tabs []
|
(defn main-tabs []
|
||||||
(let [view-id (subscribe [:get :view-id])
|
(let [view-id (subscribe [:get :view-id])
|
||||||
prev-view-id (subscribe [:get :prev-view-id])
|
prev-view-id (subscribe [:get :prev-view-id])
|
||||||
|
tabs-hidden? (subscribe [:tabs-hidden?])
|
||||||
main-swiper (r/atom nil)
|
main-swiper (r/atom nil)
|
||||||
swiped? (r/atom false)
|
swiped? (r/atom false)
|
||||||
scroll-start (a/chan 10)
|
scroll-start (a/chan 10)
|
||||||
scroll-ended (a/chan 10)]
|
scroll-ended (a/chan 10)
|
||||||
|
tabs-were-hidden? (atom @tabs-hidden?)]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount
|
{:component-did-mount
|
||||||
#(start-scrolling-loop scroll-start scroll-ended)
|
#(start-scrolling-loop scroll-start scroll-ended)
|
||||||
|
@ -109,9 +91,10 @@
|
||||||
(fn []
|
(fn []
|
||||||
(if @swiped?
|
(if @swiped?
|
||||||
(reset! swiped? false)
|
(reset! swiped? false)
|
||||||
(when @main-swiper
|
(when (and (= @tabs-were-hidden? @tabs-hidden?) @main-swiper)
|
||||||
(let [to (scroll-to @prev-view-id @view-id)]
|
(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
|
:reagent-render
|
||||||
(fn []
|
(fn []
|
||||||
[view common-st/flex
|
[view common-st/flex
|
||||||
|
@ -120,7 +103,7 @@
|
||||||
[drawer-view
|
[drawer-view
|
||||||
[view {:style common-st/flex}
|
[view {:style common-st/flex}
|
||||||
[swiper (merge
|
[swiper (merge
|
||||||
st/main-swiper
|
(st/main-swiper @tabs-hidden?)
|
||||||
{:index (get-tab-index @view-id)
|
{:index (get-tab-index @view-id)
|
||||||
:loop false
|
:loop false
|
||||||
:ref #(reset! main-swiper %)
|
:ref #(reset! main-swiper %)
|
||||||
|
@ -131,4 +114,5 @@
|
||||||
[tabs {:selected-view-id @view-id
|
[tabs {:selected-view-id @view-id
|
||||||
:prev-view-id @prev-view-id
|
:prev-view-id @prev-view-id
|
||||||
:tab-list tab-list}]
|
:tab-list tab-list}]
|
||||||
[bottom-shadow-view]]]]])})))
|
(when-not @tabs-hidden?
|
||||||
|
[bottom-shadow-view])]]]])})))
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
[status-im.utils.platform :refer [platform-specific]]))
|
[status-im.utils.platform :refer [platform-specific]]))
|
||||||
|
|
||||||
(defn bottom-shadow-view []
|
(defn bottom-shadow-view []
|
||||||
(if (get-in platform-specific [:tabs :tab-shadows?])
|
(when (get-in platform-specific [:tabs :tab-shadows?])
|
||||||
[linear-gradient {:locations [0 0.8 1]
|
[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)"]
|
:colors ["rgba(24, 52, 76, 0)" "rgba(24, 52, 76, 0.085)" "rgba(24, 52, 76, 0.165)"]
|
||||||
:style (merge
|
:style (merge
|
||||||
st/bottom-gradient
|
st/bottom-gradient
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
(ns status-im.components.tabs.styles
|
(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 tab-height (dec tabs-height))
|
||||||
|
|
||||||
(def bottom-gradient
|
(def bottom-gradient
|
||||||
|
@ -12,12 +14,11 @@
|
||||||
|
|
||||||
(defn tabs-container [hidden?]
|
(defn tabs-container [hidden?]
|
||||||
{:position :absolute
|
{:position :absolute
|
||||||
:bottom 0
|
:bottom (if hidden? (- tabs-height) 0)
|
||||||
:left 0
|
:left 0
|
||||||
:right 0
|
:right 0
|
||||||
:height tabs-height
|
:height tabs-height
|
||||||
:background-color color-white
|
:background-color st/color-white
|
||||||
:margin-bottom (if hidden? (- tabs-height) 0)
|
|
||||||
:transform [{:translateY 1}]})
|
:transform [{:translateY 1}]})
|
||||||
|
|
||||||
(def tabs-container-line
|
(def tabs-container-line
|
||||||
|
@ -37,12 +38,12 @@
|
||||||
:justifyContent :center
|
:justifyContent :center
|
||||||
:alignItems :center})
|
:alignItems :center})
|
||||||
|
|
||||||
(def tab-title
|
(defn tab-title [active?]
|
||||||
{:font-size 12
|
{:font-size (if-not (or active? p/ios?) 12 14)
|
||||||
:height 16
|
:height 16
|
||||||
:min-width 60
|
:min-width 60
|
||||||
:text-align :center
|
:text-align :center
|
||||||
:color "#6e93d8"})
|
:color (if active? st/color-light-blue st/color-gray4)})
|
||||||
|
|
||||||
(def tab-icon
|
(def tab-icon
|
||||||
{:width 24
|
{:width 24
|
||||||
|
@ -50,22 +51,16 @@
|
||||||
:marginBottom 1
|
:marginBottom 1
|
||||||
:align-self :center})
|
:align-self :center})
|
||||||
|
|
||||||
(defn tab-container [active?]
|
(def tab-container
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:height tab-height
|
:height tab-height
|
||||||
:justifyContent :center
|
|
||||||
:alignItems :center
|
|
||||||
:padding-top (if active? 0 16)})
|
|
||||||
|
|
||||||
(defn animated-offset [value]
|
|
||||||
{:top value
|
|
||||||
:justifyContent :center
|
:justifyContent :center
|
||||||
:alignItems :center})
|
:alignItems :center})
|
||||||
|
|
||||||
(def main-swiper
|
(defn main-swiper [tabs-hidden?]
|
||||||
{:position :absolute
|
{:position :absolute
|
||||||
:top 0
|
:top 0
|
||||||
:left 0
|
:left 0
|
||||||
:right 0
|
:right 0
|
||||||
:bottom tabs-height
|
:bottom (if tabs-hidden? 0 tabs-height)
|
||||||
:shows-pagination false})
|
:shows-pagination false})
|
||||||
|
|
|
@ -1,58 +1,23 @@
|
||||||
(ns status-im.components.tabs.tab
|
(ns status-im.components.tabs.tab
|
||||||
(:require-macros [status-im.utils.views :refer [defview]])
|
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[status-im.components.react :refer [view
|
[status-im.components.react :refer [view
|
||||||
animated-view
|
|
||||||
text
|
text
|
||||||
image
|
image
|
||||||
touchable-highlight]]
|
touchable-highlight]]
|
||||||
[reagent.core :as r]
|
[status-im.utils.platform :as p]
|
||||||
[status-im.components.tabs.styles :as st]
|
[status-im.components.tabs.styles :as st]))
|
||||||
[status-im.components.animation :as anim]))
|
|
||||||
|
|
||||||
(defn animation-logic [val to-value]
|
(defn tab [{:keys [view-id title icon-active icon-inactive selected-view-id prev-view-id]}]
|
||||||
(fn []
|
(let [active? (= view-id selected-view-id)
|
||||||
(anim/start (anim/spring val {:toValue to-value
|
previous? (= view-id prev-view-id)]
|
||||||
: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
|
[touchable-highlight {:style st/tab
|
||||||
:disabled (= view-id selected-view-id)
|
:disabled active?
|
||||||
:onPress #(dispatch [:navigate-to-tab view-id])}
|
:onPress #(dispatch [:navigate-to-tab view-id])}
|
||||||
[view {:style (st/tab-container (= selected-view-id view-id))}
|
[view {:style st/tab-container}
|
||||||
[animated-view {:style (st/animated-offset (cond
|
[view
|
||||||
(= selected-view-id view-id) icon-anim-value
|
[image {:source {:uri (if active? icon-active icon-inactive)}
|
||||||
(= prev-view-id view-id) icon-reverse-anim-value
|
|
||||||
:else 0))}
|
|
||||||
[image {:source {:uri icon}
|
|
||||||
:style st/tab-icon}]]
|
:style st/tab-icon}]]
|
||||||
[animated-view {:style (st/animated-offset (cond
|
[view
|
||||||
(= selected-view-id view-id) text-anim-value
|
[text {:style (st/tab-title active?)
|
||||||
(= prev-view-id view-id) text-reverse-anim-value
|
:font (if (and p/ios? active?) :medium :regular)}
|
||||||
:else 0))}
|
title]]]]))
|
||||||
[text {:style st/tab-title}
|
|
||||||
(if (or (= selected-view-id view-id)
|
|
||||||
(= prev-view-id view-id))
|
|
||||||
title
|
|
||||||
" ")]]]])})))
|
|
||||||
|
|
|
@ -21,36 +21,13 @@
|
||||||
:prev-view-id prev-view-id})]
|
:prev-view-id prev-view-id})]
|
||||||
[tab data]))
|
[tab data]))
|
||||||
|
|
||||||
(defn animation-logic [{:keys [hidden? val]}]
|
(defn tabs-container [& children]
|
||||||
(let [was-hidden? (atom (not @hidden?))]
|
(let [tabs-hidden? (subscribe [:tabs-hidden?])
|
||||||
(fn [_]
|
shadows? (get-in platform-specific [:tabs :tab-shadows?])]
|
||||||
(when (not= @was-hidden? @hidden?)
|
(into [animated-view {:style (merge (st/tabs-container @tabs-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))
|
(if-not shadows? st/tabs-container-line))
|
||||||
:pointerEvents (if @chats-scrolled? :none :auto)}]
|
:pointerEvents (if @tabs-hidden? :none :auto)}]
|
||||||
children))})))
|
children)))
|
||||||
|
|
||||||
(defn tabs [{:keys [tab-list selected-view-id prev-view-id]}]
|
(defn tabs [{:keys [tab-list selected-view-id prev-view-id]}]
|
||||||
[tabs-container
|
[tabs-container
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.components.toolbar-new.styles
|
(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
|
(:require [status-im.components.styles :refer [text1-color
|
||||||
color-white
|
color-white
|
||||||
color-light-gray
|
color-light-gray
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
(merge {:flex-direction :row}
|
(merge {:flex-direction :row}
|
||||||
(get-in p/platform-specific [:component-styles :toolbar-new])))
|
(get-in p/platform-specific [:component-styles :toolbar-new])))
|
||||||
|
|
||||||
(defnstyles toolbar-nav-actions-container
|
(defnstyle toolbar-nav-actions-container
|
||||||
[actions]
|
[actions]
|
||||||
{:flex-direction :row
|
{:flex-direction :row
|
||||||
:ios {:width (when (and actions (pos? (count actions)))
|
:ios {:width (when (and actions (pos? (count actions)))
|
||||||
|
|
|
@ -152,8 +152,9 @@
|
||||||
contacts-count [:added-contacts-count]
|
contacts-count [:added-contacts-count]
|
||||||
click-handler [:get :contacts-click-handler]
|
click-handler [:get :contacts-click-handler]
|
||||||
edit? [:get-in [:contacts-ui-props :edit?]]
|
edit? [:get-in [:contacts-ui-props :edit?]]
|
||||||
groups [:all-added-groups]]
|
groups [:all-added-groups]
|
||||||
[view st/contacts-list-container
|
tabs-hidden? [:tabs-hidden?]]
|
||||||
|
[view (st/contacts-list-container tabs-hidden?)
|
||||||
(if edit?
|
(if edit?
|
||||||
[toolbar-edit]
|
[toolbar-edit]
|
||||||
[toolbar-view])
|
[toolbar-view])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.contacts.styles
|
(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
|
(:require [status-im.components.styles :refer [text1-color
|
||||||
text2-color
|
text2-color
|
||||||
text3-color
|
text3-color
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
color-light-red
|
color-light-red
|
||||||
color-gray]]
|
color-gray]]
|
||||||
[status-im.components.toolbar.styles :refer [toolbar-background1 toolbar-background2]]
|
[status-im.components.toolbar.styles :refer [toolbar-background1 toolbar-background2]]
|
||||||
|
[status-im.components.tabs.styles :as tabs-st]
|
||||||
[status-im.utils.platform :as p]))
|
[status-im.utils.platform :as p]))
|
||||||
|
|
||||||
;; Contacts list
|
;; Contacts list
|
||||||
|
@ -22,10 +23,10 @@
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:background-color toolbar-background2})
|
:background-color toolbar-background2})
|
||||||
|
|
||||||
(defstyles contacts-list-container
|
(defnstyle contacts-list-container [tabs-hidden?]
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:android {:margin-bottom 20}
|
:android {:margin-bottom 20}
|
||||||
:ios {:margin-bottom 72}})
|
:ios {:margin-bottom (if tabs-hidden? 20 (+ 16 tabs-st/tabs-height))}})
|
||||||
|
|
||||||
(def contacts-list
|
(def contacts-list
|
||||||
{:background-color color-white})
|
{:background-color color-white})
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
:qr-codes {}
|
:qr-codes {}
|
||||||
:keyboard-height 0
|
:keyboard-height 0
|
||||||
:animations {;; todo clear this
|
:animations {;; todo clear this
|
||||||
:tabs-bar-value (anim/create-value 0)}
|
}
|
||||||
:loading-allowed true
|
:loading-allowed true
|
||||||
|
|
||||||
:sync-state :done
|
:sync-state :done
|
||||||
|
|
|
@ -78,12 +78,13 @@
|
||||||
search-text [:get-in [:toolbar-search :text]]
|
search-text [:get-in [:toolbar-search :text]]
|
||||||
contacts [:get :contacts]
|
contacts [:get :contacts]
|
||||||
current-account [:get-current-account]
|
current-account [:get-current-account]
|
||||||
discoveries [:get-recent-discoveries]]
|
discoveries [:get-recent-discoveries]
|
||||||
|
tabs-hidden? [:tabs-hidden?]]
|
||||||
[view st/discover-container
|
[view st/discover-container
|
||||||
[toolbar-view (and current-view?
|
[toolbar-view (and current-view?
|
||||||
(= show-search :discover)) search-text]
|
(= show-search :discover)) search-text]
|
||||||
(if discoveries
|
(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
|
[discover-popular {:contacts contacts
|
||||||
:current-account current-account}]
|
:current-account current-account}]
|
||||||
[discover-recent {:current-account current-account}]]
|
[discover-recent {:current-account current-account}]]
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
(ns status-im.discover.styles
|
(ns status-im.discover.styles
|
||||||
|
(:require-macros [status-im.utils.styles :refer [defnstyle]])
|
||||||
(:require [status-im.components.styles :refer [color-white
|
(:require [status-im.components.styles :refer [color-white
|
||||||
color-light-gray
|
color-light-gray
|
||||||
color-blue]]
|
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
|
;; Common
|
||||||
|
|
||||||
|
@ -138,6 +141,10 @@
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:backgroundColor color-white})
|
: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
|
(def search-icon
|
||||||
{:width 17
|
{:width 17
|
||||||
:height 17})
|
:height 17})
|
||||||
|
|
|
@ -33,3 +33,13 @@
|
||||||
accounts (subscribe [:get :accounts])]
|
accounts (subscribe [:get :accounts])]
|
||||||
(reaction (when (and @accounts @account-id)
|
(reaction (when (and @accounts @account-id)
|
||||||
(get-in @accounts [@account-id :signed-up?]))))))
|
(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?))))))
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
(ns status-im.utils.styles)
|
(ns status-im.utils.styles)
|
||||||
|
|
||||||
(defn body [styles]
|
(defn body [style]
|
||||||
`(let [styles# ~styles
|
`(let [style# ~style
|
||||||
common# (dissoc styles# :android :ios)
|
common# (dissoc style# :android :ios)
|
||||||
platform# (keyword status-im.utils.platform/platform)
|
platform# (keyword status-im.utils.platform/platform)
|
||||||
platform-specific# (get styles# platform#)]
|
platform-specific# (get style# platform#)]
|
||||||
(if platform-specific#
|
(if platform-specific#
|
||||||
(merge common# platform-specific#)
|
(merge common# platform-specific#)
|
||||||
common#)))
|
common#)))
|
||||||
|
|
||||||
(defmacro defstyles
|
(defmacro defstyle
|
||||||
"Defines styles symbol.
|
"Defines style symbol.
|
||||||
Styles parameter may contain plaform specific styles:
|
Style parameter may contain plaform specific style:
|
||||||
{:width 100
|
{:width 100
|
||||||
:height 125
|
:height 125
|
||||||
:ios {:height 20}
|
:ios {:height 20}
|
||||||
:android {:margin-top 3}}
|
:android {:margin-top 3}}
|
||||||
|
|
||||||
Reuslting styles for Android:
|
Reuslting style for Android:
|
||||||
{:width 100
|
{:width 100
|
||||||
:height 125
|
:height 125
|
||||||
:margin-top 3}
|
:margin-top 3}
|
||||||
|
|
||||||
Resulting styles for iOS:
|
Resulting style for iOS:
|
||||||
{:width 100
|
{:width 100
|
||||||
:height 20}"
|
:height 20}"
|
||||||
[style-name styles]
|
[style-name style]
|
||||||
`(def ~style-name
|
`(def ~style-name
|
||||||
~(body styles)))
|
~(body style)))
|
||||||
|
|
||||||
(defmacro defnstyles
|
(defmacro defnstyle
|
||||||
"Defines styles function.
|
"Defines style function.
|
||||||
Styles parameter may contain plaform specific styles:
|
Style parameter may contain plaform specific style:
|
||||||
{:width 100
|
{:width 100
|
||||||
:height (* a 2)
|
:height (* a 2)
|
||||||
:ios {:height (/ a 2)}
|
:ios {:height (/ a 2)}
|
||||||
:android {:margin-top 3}}
|
:android {:margin-top 3}}
|
||||||
|
|
||||||
Resulting styles for Android (with (= a 10)):
|
Resulting style for Android (with (= a 10)):
|
||||||
{:width 100
|
{:width 100
|
||||||
:height 20
|
:height 20
|
||||||
:margin-top 3}
|
:margin-top 3}
|
||||||
|
|
||||||
Resulting styles for iOS (with (= a 10)):
|
Resulting style for iOS (with (= a 10)):
|
||||||
{:width 100
|
{:width 100
|
||||||
:height 5}"
|
:height 5}"
|
||||||
[style-name params styles]
|
[style-name params style]
|
||||||
`(defn ~style-name
|
`(defn ~style-name
|
||||||
[~@params]
|
[~@params]
|
||||||
~(body styles)))
|
~(body style)))
|
||||||
|
|