-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e126a7
commit 534a961
Showing
11 changed files
with
259 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(ns quo2.components.bottom-tabs | ||
(:require [quo.theme :as theme] | ||
[quo2.navigation :as quo2-navigation] | ||
[quo.react-native :as rn] | ||
[quo2.components.switcher :as switcher] | ||
[reagent.core :as reagent] | ||
[quo2.foundations.colors :as colors] | ||
[status-im.utils.platform :as platform] | ||
[status-im.ui.components.icons.icons :as icons] | ||
[status-im.utils.handlers :refer [>evt]])) | ||
|
||
(def selected-tab (reagent/atom :quo2-preview)) | ||
|
||
(def themes | ||
{:light {:background-color colors/neutral-70-opa-90 | ||
:non-selected-tab colors/neutral-50 | ||
:selected-tab colors/white} | ||
:dark {:background-color colors/neutral-80-opa-90 | ||
:non-selected-tab colors/neutral-40 | ||
:selected-tab colors/white}}) | ||
|
||
(defn get-color [key] | ||
(get-in themes [(theme/get-theme) key])) | ||
|
||
(defn bottom-tab-pressed [tab] | ||
(when-not (= tab @selected-tab) | ||
(reset! selected-tab tab) | ||
(>evt [::quo2-navigation/quo2-navigate-change-tab tab]))) | ||
|
||
(defn bottom-tab [icon tab] | ||
[rn/touchable-opacity {:style {:padding 15} | ||
:active-opacity 1 | ||
:on-press #(bottom-tab-pressed tab)} | ||
[icons/icon icon {:width 25 | ||
:height 25 | ||
:color (get-color | ||
(if (= tab @selected-tab) | ||
:selected-tab | ||
:non-selected-tab))}]]) | ||
|
||
(defn bottom-tabs [] | ||
[:<> | ||
[rn/view {:style | ||
{:background-color (get-color :background-color) | ||
:flex-direction :row | ||
:flex 1 | ||
:align-items :center | ||
:justify-content :space-around | ||
:height (if platform/android? 60 80) | ||
:position :absolute | ||
:bottom 0 | ||
:right 0 | ||
:left 0}} ;; TODO - use different height for android and ios(Confirm from Design) | ||
[bottom-tab :main-icons/message :quo2-preview] | ||
[bottom-tab :main-icons/browser :browser] | ||
[rn/view {:width 10}] | ||
[bottom-tab :main-icons/wallet :wallet] | ||
[bottom-tab :main-icons/user-profile :profile]] | ||
[switcher/switcher-button]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns quo2.components.switcher | ||
(:require [quo.react-native :as rn] | ||
[quo2.navigation :as quo2-navigation] | ||
[status-im.utils.handlers :refer [>evt]] | ||
[quo2.components.button :as button] | ||
[status-im.react-native.resources :as resources])) | ||
|
||
(defn switcher-button [] | ||
[rn/touchable-opacity {:active-opacity 1 | ||
:on-press #(>evt [::quo2-navigation/quo2-open-modal | ||
:quo2-switcher-screen]) | ||
:style {:position :absolute | ||
:bottom 35 | ||
:justify-content :center | ||
:align-items :center | ||
:align-self :center}} | ||
[rn/image {:source (resources/get-image :status-logo) | ||
:style {:width 48 | ||
:height 48}}]]) | ||
|
||
(defn switcher-screen [] | ||
[rn/view {:style {:flex 1 | ||
:background-color "#040B14CC" | ||
:justify-content :center | ||
:align-items :center}} | ||
[rn/view {:style {:position :absolute | ||
:top 100}} | ||
[button/button {:on-press #(>evt [::quo2-navigation/quo2-open-modal :quo2-mock-screen4]) | ||
:size 32} "Open New Screen"]] | ||
[rn/view {:style {:position :absolute | ||
:bottom 50}} | ||
[button/button {:on-press #(>evt [::quo2-navigation/quo2-close-modal | ||
:quo2-switcher-screen]) | ||
:size 32} "Close"]]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(ns quo2.navigation | ||
(:require [status-im.utils.fx :as fx])) | ||
|
||
(fx/defn quo2-init-root | ||
{:events [::quo2-init-root]} | ||
[_ root-id] | ||
{:quo2-init-root-fx root-id}) | ||
|
||
(fx/defn quo2-change-tab | ||
{:events [::quo2-navigate-change-tab]} | ||
[_ tab] | ||
{:quo2-change-tab-fx tab}) | ||
|
||
(fx/defn quo2-open-modal | ||
{:events [::quo2-open-modal]} | ||
[_ modal] | ||
{:quo2-open-modal-fx modal}) | ||
|
||
(fx/defn quo2-close-modal | ||
{:events [::quo2-close-modal]} | ||
[_ modal] | ||
{:quo2-close-modal-fx modal}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
(ns quo2.navigation.core | ||
(:require [re-frame.core :as re-frame] | ||
[quo2.navigation.roots :as roots] | ||
["react-native-navigation" :refer (Navigation)])) | ||
|
||
(re-frame/reg-fx | ||
:quo2-init-root-fx | ||
(fn [new-root-id] | ||
(.setRoot Navigation (clj->js (get (roots/roots) new-root-id))))) | ||
|
||
(def tab-key-idx {:quo2-preview 0 | ||
:browser 1 | ||
:wallet 2 | ||
:profile 3}) | ||
|
||
(re-frame/reg-fx | ||
:quo2-change-tab-fx | ||
(fn [tab] | ||
(.mergeOptions Navigation "quo2-tabs-stack" (clj->js {:bottomTabs {:currentTabIndex (get tab-key-idx tab)}})))) | ||
|
||
(defn open-modal [comp] | ||
(.showModal Navigation | ||
(clj->js {:stack {:children | ||
[{:component | ||
{:name comp | ||
:id comp | ||
:options {:topBar {:visible false} | ||
:modalPresentationStyle "overCurrentContext" | ||
:layout {:backgroundColor "transparent"}}}}]}}))) | ||
|
||
(defn close-modal [] | ||
(.dismissAllModals Navigation)) | ||
|
||
(re-frame/reg-fx :quo2-open-modal-fx open-modal) | ||
|
||
(re-frame/reg-fx :quo2-close-modal-fx close-modal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns quo2.navigation.roots | ||
(:require [status-im.navigation.roots :as nav-roots])) | ||
|
||
(defn roots [] | ||
{:quo2-tabs-stack | ||
{:root | ||
{:bottomTabs | ||
{:id :quo2-tabs-stack | ||
:options (merge (nav-roots/default-root) | ||
{:bottomTabs {:titleDisplayMode :alwaysHide | ||
:tabsAttachMode :together | ||
:visible false | ||
:animate false}}) | ||
:children [{:stack {:id :profile-stack | ||
:children [{:component {:name :quo2-preview | ||
:id :quo2-preview | ||
:options {:topBar {:visible false}}}}] | ||
:options {:bottomTab (nav-roots/bottom-tab-general :main-icons/message :home-tab-button)}}} | ||
{:stack {:id :browser-stack | ||
:children [{:component {:name :quo2-mock-screen2 | ||
:id :empty-tab | ||
:options {:topBar {:visible false}}}}] | ||
|
||
:options {:bottomTab (nav-roots/bottom-tab-general :main-icons/browser :dapp-tab-button)}}} | ||
{:stack {:id :wallet-stack | ||
:children [{:component {:name :quo2-mock-screen3 | ||
:id :wallet | ||
:options {:topBar {:visible false}}}}] | ||
:options {:bottomTab (nav-roots/bottom-tab-general :main-icons/wallet :wallet-tab-button)}}} | ||
{:stack {:id :quo2-preview-stack | ||
:children [{:component {:name :quo2-exit-screen | ||
:id :quo2-exit-screen | ||
:options {:topBar {:visible false}}}}] | ||
:options {:bottomTab (nav-roots/bottom-tab-general :main-icons/user-profile :profile-tab-button)}}}]}}}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(ns quo2.screens.mock | ||
(:require [quo.react-native :as rn] | ||
[re-frame.core :as re-frame] | ||
[quo2.components.button :as button] | ||
[quo2.components.bottom-tabs :as bottom-tabs])) | ||
|
||
(defn screen2 [] | ||
[:<> | ||
[rn/text {:style {:font-size 40 :align-self :center :margin-top 100}} "Screen 2"] | ||
[bottom-tabs/bottom-tabs]]) | ||
|
||
(defn screen3 [] | ||
[:<> | ||
[rn/text {:style {:font-size 40 :align-self :center :margin-top 100}} "Screen 3"] | ||
[bottom-tabs/bottom-tabs]]) | ||
|
||
(defn screen4 [] | ||
[:<> | ||
[rn/text {:style {:font-size 40 :align-self :center}} "Modal Screen"]]) | ||
|
||
(defn exit-screen [] | ||
[rn/view {:style {:flex 1 | ||
:justify-content :center | ||
:align-items :center}} | ||
[rn/view {:style {:position :absolute | ||
:bottom 150}} | ||
[button/button {:on-press #(re-frame/dispatch [:init-root :chat-stack])} "Exit Quo 2"]] | ||
[bottom-tabs/bottom-tabs]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters