[Fix #3485] Increase tap zones for rows with checkboxes

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Foo Pang 2018-03-04 13:49:27 +08:00 committed by Julien Eluard
parent 615fd7a32b
commit cad3770b48
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
4 changed files with 27 additions and 15 deletions

View File

@ -7,6 +7,7 @@
[status-im.ui.components.checkbox.view :as checkbox] [status-im.ui.components.checkbox.view :as checkbox]
[status-im.ui.components.contact.styles :as styles] [status-im.ui.components.contact.styles :as styles]
[status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.list-selection :as list-selection]
[status-im.ui.components.list.views :as list]
[status-im.utils.gfycat.core :as gfycat])) [status-im.utils.gfycat.core :as gfycat]))
(defn- contact-inner-view (defn- contact-inner-view
@ -42,7 +43,9 @@
(views/defview toogle-contact-view [{:keys [whisper-identity] :as contact} selected-key on-toggle-handler] (views/defview toogle-contact-view [{:keys [whisper-identity] :as contact} selected-key on-toggle-handler]
(views/letsubs [checked [selected-key whisper-identity]] (views/letsubs [checked [selected-key whisper-identity]]
[react/view styles/contact-container [list/list-item-with-checkbox
[contact-inner-view {:contact contact}] {:checked? checked
[checkbox/checkbox {:checked? checked :on-value-change #(on-toggle-handler checked whisper-identity)
:on-value-change #(on-toggle-handler checked whisper-identity)}]])) :plain-checkbox? true}
[react/view styles/contact-container
[contact-inner-view {:contact contact}]]]))

View File

@ -82,6 +82,12 @@
[react/view {:style (merge style styles/item-checkbox)} [react/view {:style (merge style styles/item-checkbox)}
[checkbox/checkbox props]]) [checkbox/checkbox props]])
(defn list-item-with-checkbox [{:keys [on-value-change checked? plain-checkbox?] :as props} item]
(let [handler #(on-value-change (not checked?))
checkbox [(if plain-checkbox? checkbox/checkbox item-checkbox) props]
item (conj item checkbox)]
[touchable-item handler item]))
(def item-icon-forward (def item-icon-forward
[item-icon {:icon :icons/forward [item-icon {:icon :icons/forward
:icon-opts {:color colors/white-light-transparent}}]) :icon-opts {:color colors/white-light-transparent}}])

View File

@ -12,13 +12,14 @@
[status-im.utils.ethereum.tokens :as tokens])) [status-im.utils.ethereum.tokens :as tokens]))
(defn- render-token [{:keys [symbol name icon]} visible-tokens] (defn- render-token [{:keys [symbol name icon]} visible-tokens]
[list/item [list/list-item-with-checkbox
[list/item-image icon] {:checked? (contains? visible-tokens (keyword symbol))
[list/item-content :on-value-change #(re-frame/dispatch [:wallet.settings/toggle-visible-token (keyword symbol) %])}
[list/item-primary name] [list/item
[list/item-secondary symbol]] [list/item-image icon]
[list/item-checkbox {:checked? (contains? visible-tokens (keyword symbol)) [list/item-content
:on-value-change #(re-frame/dispatch [:wallet.settings/toggle-visible-token (keyword symbol) %])}]]) [list/item-primary name]
[list/item-secondary symbol]]]])
(defview manage-assets [] (defview manage-assets []
(letsubs [network [:network] (letsubs [network [:network]

View File

@ -122,10 +122,12 @@
;; Filter history ;; Filter history
(defn- item-filter [{:keys [icon checked? path]} content] (defn- item-filter [{:keys [icon checked? path]} content]
[list/item [list/list-item-with-checkbox
[list/item-icon icon] {:checked? checked?
content :on-value-change #(re-frame/dispatch [:wallet.transactions/filter path %])}
[list/item-checkbox {:checked? checked? :on-value-change #(re-frame/dispatch [:wallet.transactions/filter path %])}]]) [list/item
[list/item-icon icon]
content]])
(defn- render-item-filter [{:keys [id label checked?]}] (defn- render-item-filter [{:keys [id label checked?]}]
[item-filter {:icon (transaction-type->icon id) :checked? checked? :path {:type id}} [item-filter {:icon (transaction-type->icon id) :checked? checked? :path {:type id}}