mirror of
https://github.com/status-im/status-react.git
synced 2025-02-17 05:16:46 +00:00
[#3832] Hide tab bar when keyboard visible
This commit is contained in:
parent
62af757fa1
commit
c145c8a19f
@ -44,13 +44,16 @@
|
|||||||
"keyboardDidShow"
|
"keyboardDidShow"
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(let [h (.. e -endCoordinates -height)]
|
(let [h (.. e -endCoordinates -height)]
|
||||||
|
(dispatch [:hide-tab-bar])
|
||||||
(when-not (= h @keyboard-height)
|
(when-not (= h @keyboard-height)
|
||||||
(dispatch [:set :keyboard-height h])
|
(dispatch [:set :keyboard-height h])
|
||||||
(dispatch [:set :keyboard-max-height h])))))
|
(dispatch [:set :keyboard-max-height h])))))
|
||||||
(.addListener react/keyboard
|
(.addListener react/keyboard
|
||||||
"keyboardDidHide"
|
"keyboardDidHide"
|
||||||
#(when-not (= 0 @keyboard-height)
|
(fn [_]
|
||||||
(dispatch [:set :keyboard-height 0])))
|
(dispatch [:show-tab-bar])
|
||||||
|
(when (zero? @keyboard-height)
|
||||||
|
(dispatch [:set :keyboard-height 0]))))
|
||||||
(.hide react/splash-screen)
|
(.hide react/splash-screen)
|
||||||
(.addEventListener react/app-state "change" app-state-change-handler))
|
(.addEventListener react/app-state "change" app-state-change-handler))
|
||||||
:component-did-mount
|
:component-did-mount
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
(def app-db {:current-public-key nil
|
(def app-db {:current-public-key nil
|
||||||
:status-module-initialized? (or platform/ios? js/goog.DEBUG)
|
:status-module-initialized? (or platform/ios? js/goog.DEBUG)
|
||||||
:keyboard-height 0
|
:keyboard-height 0
|
||||||
|
:tab-bar-visible? true
|
||||||
:accounts/accounts {}
|
:accounts/accounts {}
|
||||||
:navigation-stack '()
|
:navigation-stack '()
|
||||||
:contacts/contacts {}
|
:contacts/contacts {}
|
||||||
@ -64,6 +65,7 @@
|
|||||||
;;height of native keyboard if shown
|
;;height of native keyboard if shown
|
||||||
(spec/def ::keyboard-height (spec/nilable number?))
|
(spec/def ::keyboard-height (spec/nilable number?))
|
||||||
(spec/def ::keyboard-max-height (spec/nilable number?))
|
(spec/def ::keyboard-max-height (spec/nilable number?))
|
||||||
|
(spec/def ::tab-bar-visible? (spec/nilable boolean?))
|
||||||
;;:online - presence of internet connection in the phone
|
;;:online - presence of internet connection in the phone
|
||||||
(spec/def ::network-status (spec/nilable keyword?))
|
(spec/def ::network-status (spec/nilable keyword?))
|
||||||
|
|
||||||
@ -184,6 +186,7 @@
|
|||||||
::status-node-started?
|
::status-node-started?
|
||||||
::keyboard-height
|
::keyboard-height
|
||||||
::keyboard-max-height
|
::keyboard-max-height
|
||||||
|
::tab-bar-visible?
|
||||||
::network-status
|
::network-status
|
||||||
::mailserver-status
|
::mailserver-status
|
||||||
::peers-count
|
::peers-count
|
||||||
|
@ -400,3 +400,13 @@
|
|||||||
[re-frame/trim-v]
|
[re-frame/trim-v]
|
||||||
(fn [db [item-id value]]
|
(fn [db [item-id value]]
|
||||||
(assoc-in db [:chat-animations item-id :delete-swiped] value)))
|
(assoc-in db [:chat-animations item-id :delete-swiped] value)))
|
||||||
|
|
||||||
|
(handlers/register-handler-db
|
||||||
|
:show-tab-bar
|
||||||
|
(fn [db _]
|
||||||
|
(assoc db :tab-bar-visible? true)))
|
||||||
|
|
||||||
|
(handlers/register-handler-db
|
||||||
|
:hide-tab-bar
|
||||||
|
(fn [db _]
|
||||||
|
(assoc db :tab-bar-visible? false)))
|
||||||
|
@ -65,7 +65,8 @@
|
|||||||
^{:key view-id} [tab view-id content (= view-id current-view-id) accessibility-label count-subscription])])
|
^{:key view-id} [tab view-id content (= view-id current-view-id) accessibility-label count-subscription])])
|
||||||
|
|
||||||
(views/defview main-tabs []
|
(views/defview main-tabs []
|
||||||
(views/letsubs [view-id [:get :view-id]]
|
(views/letsubs [view-id [:get :view-id]
|
||||||
|
tab-bar-visible? [:tab-bar-visible?]]
|
||||||
[react/view common.styles/flex
|
[react/view common.styles/flex
|
||||||
[status-bar.view/status-bar {:type (if (= view-id :wallet) :wallet-tab :main)}]
|
[status-bar.view/status-bar {:type (if (= view-id :wallet) :wallet-tab :main)}]
|
||||||
[react/view common.styles/main-container
|
[react/view common.styles/main-container
|
||||||
@ -93,4 +94,5 @@
|
|||||||
{:component profile.user/my-profile
|
{:component profile.user/my-profile
|
||||||
:views :my-profile
|
:views :my-profile
|
||||||
:current-view view-id}]]
|
:current-view view-id}]]
|
||||||
[tabs view-id]]]))
|
(when tab-bar-visible?
|
||||||
|
[tabs view-id])]]))
|
||||||
|
@ -57,6 +57,10 @@
|
|||||||
(fn [sync-state]
|
(fn [sync-state]
|
||||||
(#{:pending :in-progress} sync-state)))
|
(#{:pending :in-progress} sync-state)))
|
||||||
|
|
||||||
|
(reg-sub :tab-bar-visible?
|
||||||
|
(fn [db _]
|
||||||
|
(get db :tab-bar-visible?)))
|
||||||
|
|
||||||
(reg-sub :get-screen-params
|
(reg-sub :get-screen-params
|
||||||
(fn [db [_ view-id]]
|
(fn [db [_ view-id]]
|
||||||
(get-in db [:navigation/screen-params (or view-id (:view-id db))])))
|
(get-in db [:navigation/screen-params (or view-id (:view-id db))])))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user