[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.contact.styles :as styles]
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.components.list.views :as list]
[status-im.utils.gfycat.core :as gfycat]))
(defn- contact-inner-view
@ -42,7 +43,9 @@
(views/defview toogle-contact-view [{:keys [whisper-identity] :as contact} selected-key on-toggle-handler]
(views/letsubs [checked [selected-key whisper-identity]]
[react/view styles/contact-container
[contact-inner-view {:contact contact}]
[checkbox/checkbox {:checked? checked
:on-value-change #(on-toggle-handler checked whisper-identity)}]]))
[list/list-item-with-checkbox
{:checked? checked
: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)}
[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
[item-icon {:icon :icons/forward
:icon-opts {:color colors/white-light-transparent}}])

View File

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

View File

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