[Fix #3369] Migrate checkboxes to native widget
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
27e777d1bd
commit
6f0a710b53
|
@ -1,5 +1,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<color name="primary">#7099e6</color>
|
<color name="primary">#4360df</color>
|
||||||
<color name="primary_dark">#5c6bc0</color>
|
<color name="primary_dark">#5c6bc0</color>
|
||||||
<color name="accent">#5c6bc0</color>
|
<color name="accent">#5c6bc0</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
(ns status-im.ui.components.checkbox.view
|
(ns status-im.ui.components.checkbox.view
|
||||||
(:require [status-im.ui.components.checkbox.styles :as styles]
|
(:require [status-im.ui.components.checkbox.styles :as styles]
|
||||||
[status-im.ui.components.react :as react]))
|
[status-im.ui.components.react :as react]
|
||||||
|
[status-im.utils.platform :as platform]))
|
||||||
;; TODO(jeluard) Migrate to native checkbox provided by RN 0.49
|
|
||||||
;; https://facebook.github.io/react-native/docs/checkbox.html
|
|
||||||
|
|
||||||
(defn checkbox [{:keys [on-value-change checked?]}]
|
(defn checkbox [{:keys [on-value-change checked?]}]
|
||||||
[react/touchable-highlight (merge {:style styles/wrapper}
|
(if platform/android?
|
||||||
(when on-value-change {:on-press #(on-value-change (not checked?))}))
|
[react/view {:style styles/wrapper}
|
||||||
[react/view (styles/icon-check-container checked?)
|
[react/check-box {:on-value-change on-value-change
|
||||||
(when checked?
|
:value checked?}]]
|
||||||
[react/icon :check_on styles/check-icon])]])
|
[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])]]))
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
(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"))
|
||||||
(def image (get-class "Image"))
|
(def image (get-class "Image"))
|
||||||
|
(def check-box (get-class "CheckBox"))
|
||||||
|
|
||||||
(def touchable-without-feedback (get-class "TouchableWithoutFeedback"))
|
(def touchable-without-feedback (get-class "TouchableWithoutFeedback"))
|
||||||
(def touchable-highlight-class (get-class "TouchableHighlight"))
|
(def touchable-highlight-class (get-class "TouchableHighlight"))
|
||||||
|
|
Loading…
Reference in New Issue