[Fix #3369] Migrate checkboxes to native widget

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Foo Pang 2018-03-06 06:39:42 +08:00 committed by Julien Eluard
parent 27e777d1bd
commit 6f0a710b53
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
3 changed files with 13 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<resources>
<color name="primary">#7099e6</color>
<color name="primary">#4360df</color>
<color name="primary_dark">#5c6bc0</color>
<color name="accent">#5c6bc0</color>
</resources>

View File

@ -1,13 +1,15 @@
(ns status-im.ui.components.checkbox.view
(:require [status-im.ui.components.checkbox.styles :as styles]
[status-im.ui.components.react :as react]))
;; TODO(jeluard) Migrate to native checkbox provided by RN 0.49
;; https://facebook.github.io/react-native/docs/checkbox.html
[status-im.ui.components.react :as react]
[status-im.utils.platform :as platform]))
(defn checkbox [{:keys [on-value-change checked?]}]
(if platform/android?
[react/view {:style styles/wrapper}
[react/check-box {:on-value-change on-value-change
:value checked?}]]
[react/touchable-highlight (merge {:style styles/wrapper}
(when on-value-change {:on-press #(on-value-change (not checked?))}))
[react/view (styles/icon-check-container checked?)
(when checked?
[react/icon :check_on styles/check-icon])]])
[react/icon :check_on styles/check-icon])]]))

View File

@ -46,6 +46,7 @@
(def text-class (get-class "Text"))
(def text-input-class (get-class "TextInput"))
(def image (get-class "Image"))
(def check-box (get-class "CheckBox"))
(def touchable-without-feedback (get-class "TouchableWithoutFeedback"))
(def touchable-highlight-class (get-class "TouchableHighlight"))