code review for #953

This commit is contained in:
Gustavo Nunes 2017-04-11 01:30:12 -03:00 committed by Roman Volosovskyi
parent 2e67f5275b
commit ccc3eb6397
8 changed files with 19 additions and 20 deletions

View File

@ -3,7 +3,7 @@
[status-im.components.styles :as st]
[status-im.utils.utils :as u
:refer [get-react-property get-class adapt-class]]
[status-im.utils.platform :refer [platform-specific]]))
[status-im.utils.platform :refer [platform-specific ios?]]))
(def react-native (js/require "react-native"))
(def native-modules (.-NativeModules react-native))
@ -30,7 +30,7 @@
(def list-view-class (get-class "ListView"))
(def scroll-view (get-class "ScrollView"))
(def web-view (get-class "WebView"))
(def keyboard-avoiding-view (get-class "KeyboardAvoidingView"))
(def keyboard-avoiding-view-class (get-class "KeyboardAvoidingView"))
(def text-class (get-class "Text"))
(def text-input-class (get-class "TextInput"))
@ -151,3 +151,11 @@
(def http-bridge
(js/require "react-native-http-bridge"))
;; KeyboardAvoidingView
(defn keyboard-avoiding-view [props & children]
(let [view-element (if ios?
[keyboard-avoiding-view-class (merge {:behavior :padding} props)]
[view props])]
(vec (concat view-element children))))

View File

@ -55,8 +55,7 @@
type [:get :group-type]]
(let [save-btn-enabled? (and (s/valid? ::v/name group-name)
(not= group-name (:name group)))]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[keyboard-avoiding-view {:style st/group-container}
[group-toolbar type true]
[group-name-view]
[view st/list-view-container

View File

@ -63,8 +63,7 @@
type [:get :group-type]]
(let [save-btn-enabled? (and (s/valid? ::v/name new-chat-name)
(not= new-chat-name chat-name))]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[keyboard-avoiding-view {:style st/group-container}
[view {:flex 1}
[group-toolbar type true]
[scroll-view

View File

@ -57,8 +57,7 @@
[contacts [:all-added-group-contacts-filtered]
selected-contacts-count [:selected-contacts-count]
group-type [:get :group-type]]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[keyboard-avoiding-view {:style st/group-container}
[status-bar]
[toggle-list-toolbar
(label (if (= group-type :contact-group)
@ -73,8 +72,7 @@
[contacts [:all-group-not-added-contacts-filtered]
group [:get-contact-group]
selected-contacts-count [:selected-contacts-count]]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[keyboard-avoiding-view {:style st/group-container}
[status-bar]
[toggle-list-toolbar (:name group) selected-contacts-count]
[toggle-list contacts group-toggle-contact]
@ -87,8 +85,7 @@
[contacts [:contacts-filtered :all-new-contacts]
chat-name [:chat :name]
selected-contacts-count [:selected-participants-count]]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[keyboard-avoiding-view {:style st/group-container}
[status-bar]
[toggle-list-toolbar chat-name selected-contacts-count]
[toggle-list contacts group-toggle-participant]
@ -96,5 +93,3 @@
[sticky-button (label :t/save) #(do
(dispatch [:add-new-participants])
(dispatch [:navigate-back]))])])

View File

@ -90,8 +90,7 @@
profile-edit-data-changed? (or (not= (:name current-account) (:name changed-account))
(not= (:status current-account) (:status changed-account))
(not= (:photo-path current-account) (:photo-path changed-account)))]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/profile)
[keyboard-avoiding-view {:style st/profile}
[status-bar]
[edit-my-profile-toolbartoolbar]
[view st/edit-my-profile-form

View File

@ -155,8 +155,7 @@
(dispatch [::check-completed-transaction!
{:message-id message-id}]))
(dispatch [::remove-transaction id]))
(when (or (= modal :pending-transactions)
(= modal :transaction-details))
(when (#{:pending-transactions :transaction-details} modal)
(dispatch [:navigate-to-modal :confirmation-success])))))))
(register-handler ::add-transactions-hash

View File

@ -47,7 +47,7 @@
confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]]
{:component-did-update #(when-not (seq transactions) (rf/dispatch [:navigate-back]))
:component-will-unmount #(rf/dispatch [:set-in [:transactions-list-ui-props :confirmed?] false])}
[(if platform/ios? rn/keyboard-avoiding-view rn/view) (merge {:behavior :padding} st/transactions-screen)
[rn/keyboard-avoiding-view {:style st/transactions-screen}
[status-bar/status-bar {:type (if platform/ios? :transparent :main)}]
[toolbar-view transactions]
[rn/view {:style st/transactions-screen-content-container}

View File

@ -50,7 +50,7 @@
confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]]
{:component-did-update #(when-not transaction (rf/dispatch [:navigate-to-modal :pending-transactions]))
:component-will-unmount #(rf/dispatch [:set-in [:transaction-details-ui-props :confirmed?] false])}
[(if platform/ios? rn/keyboard-avoiding-view rn/view) (merge {:behavior :padding} st/transactions-screen)
[rn/keyboard-avoiding-view {:style st/transactions-screen}
[status-bar/status-bar {:type (if platform/ios? :transparent :main)}]
[toolbar-view]
[rn/scroll-view st/details-screen-content-container