[#4149] fixed modal on iphonex

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-05-10 14:34:47 +03:00
parent 37fe1e2b9e
commit 68bb21c598
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 100 additions and 93 deletions

View File

@ -210,9 +210,6 @@
;; Platform-specific View
(def platform-specific-view
(if platform/iphone-x? safe-area-view view))
(defmulti create-main-screen-view #(cond
platform/iphone-x? :iphone-x
platform/ios? :ios

View File

@ -75,7 +75,8 @@
;;; - edit-my-profile -
;;; |
;;; - profile-photo-capture
(views/compile-views root-view
(views/compile-views
root-view
[{:views #{:home :wallet :my-profile}
:component main-tabs}
@ -113,13 +114,8 @@
:parent :my-profile
:component profile-photo-capture}])
(defview main []
(letsubs [signed-up? [:signed-up?]
view-id [:get :view-id]
modal-view [:get :modal]]
{:component-will-update (fn [] (react/dismiss-keyboard!))}
(when view-id
(let [component (case view-id
(defn get-main-component [view-id]
(case view-id
:intro intro
:create-account create-account
:usage-data usage-data
@ -160,7 +156,37 @@
:contact-code contact-code
:profile-qr-viewer profile.user/qr-viewer
:backup-seed backup-seed
[react/view [react/text (str "Unknown view: " view-id)]])
[react/view [react/text (str "Unknown view: " view-id)]]))
(defn get-modal-component [modal-view]
(case modal-view
:qr-scanner qr-scanner
:contact-list-modal contact-list-modal
:wallet-transactions-filter wallet-transactions/filter-history
:wallet-settings-assets wallet-settings/manage-assets
:wallet-send-transaction-modal send-transaction-modal
:wallet-transaction-sent-modal transaction-sent-modal
:wallet-sign-message-modal sign-message-modal
:wallet-transaction-fee wallet.send/transaction-fee
[react/view [react/text (str "Unknown modal view: " modal-view)]]))
(defview main-modal []
(letsubs [modal-view [:get :modal]]
(when modal-view
[view common-styles/modal
[modal {:animation-type :slide
:transparent true
:on-request-close #(dispatch [:navigate-back])}
(let [component (get-modal-component modal-view)]
[react/main-screen-modal-view modal-view
[component]])]])))
(defview main []
(letsubs [signed-up? [:signed-up?]
view-id [:get :view-id]]
{:component-will-update (fn [] (react/dismiss-keyboard!))}
(when view-id
(let [component (get-main-component view-id)
main-screen-view (create-main-screen-view view-id)]
[main-screen-view common-styles/flex
(if (and config/compile-views-enabled?
@ -172,20 +198,4 @@
view-id))
[root-view]
[component])
(when modal-view
[view common-styles/modal
[modal {:animation-type :slide
:transparent true
:on-request-close #(dispatch [:navigate-back])}
(let [component (case modal-view
:qr-scanner qr-scanner
:contact-list-modal contact-list-modal
:wallet-transactions-filter wallet-transactions/filter-history
:wallet-settings-assets wallet-settings/manage-assets
:wallet-send-transaction-modal send-transaction-modal
:wallet-transaction-sent-modal transaction-sent-modal
:wallet-sign-message-modal sign-message-modal
:wallet-transaction-fee wallet.send/transaction-fee
[react/view [react/text (str "Unknown modal view: " modal-view)]])]
[react/main-screen-modal-view modal-view
[component]])]])]))))
[main-modal]]))))