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.components.styles :as st]
[status-im.utils.utils :as u [status-im.utils.utils :as u
:refer [get-react-property get-class adapt-class]] :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 react-native (js/require "react-native"))
(def native-modules (.-NativeModules react-native)) (def native-modules (.-NativeModules react-native))
@ -30,7 +30,7 @@
(def list-view-class (get-class "ListView")) (def list-view-class (get-class "ListView"))
(def scroll-view (get-class "ScrollView")) (def scroll-view (get-class "ScrollView"))
(def web-view (get-class "WebView")) (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-class (get-class "Text"))
(def text-input-class (get-class "TextInput")) (def text-input-class (get-class "TextInput"))
@ -151,3 +151,11 @@
(def http-bridge (def http-bridge
(js/require "react-native-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]] type [:get :group-type]]
(let [save-btn-enabled? (and (s/valid? ::v/name group-name) (let [save-btn-enabled? (and (s/valid? ::v/name group-name)
(not= group-name (:name group)))] (not= group-name (:name group)))]
[(if ios? keyboard-avoiding-view view) (merge {:behavior :padding} [keyboard-avoiding-view {:style st/group-container}
st/group-container)
[group-toolbar type true] [group-toolbar type true]
[group-name-view] [group-name-view]
[view st/list-view-container [view st/list-view-container

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@
confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]] confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]]
{:component-did-update #(when-not transaction (rf/dispatch [:navigate-to-modal :pending-transactions])) {: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])} :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)}] [status-bar/status-bar {:type (if platform/ios? :transparent :main)}]
[toolbar-view] [toolbar-view]
[rn/scroll-view st/details-screen-content-container [rn/scroll-view st/details-screen-content-container