diff --git a/src/status_im/ui/components/button/view.cljs b/src/status_im/ui/components/button/view.cljs index 62251785f5a..f9ffbc53803 100644 --- a/src/status_im/ui/components/button/view.cljs +++ b/src/status_im/ui/components/button/view.cljs @@ -66,43 +66,45 @@ :else theme) {:keys [icon-color background-color text-color border-color]} (themes theme')] + (println "theme" theme' background-color) [rn/touchable-without-feedback - (merge {:bg-color background-color - :border-radius border-radius - :type type - :disabled disabled - :accessibility-label accessibility-label} - (when border-color - {:border-color border-color - :border-width 1}) - (when on-press + (merge (when on-press {:on-press on-press}) (when on-long-press {:on-long-press on-long-press})) - [rn/view {:test-ID test-ID :style (merge (style-container type) style)} - (when before - [rn/view - [icons/icon before {:color icon-color}]]) - (when loading - [rn/view {:style {:position :absolute}} - [rn/activity-indicator]]) - [rn/view - {:style (merge (content-style type) - (when loading - {:opacity 0}))} - (cond - (= type :icon) - [icons/icon children {:color icon-color}] + [rn/view + (merge {:background-color background-color + :border-radius border-radius + :type type + :disabled disabled + :accessibility-label accessibility-label} + (when border-color + {:border-color border-color + :border-width 1})) + [rn/view {:test-ID test-ID :style (merge (style-container type) style)} + (when before + [rn/view + [icons/icon before {:color icon-color}]]) + (when loading + [rn/view {:style {:position :absolute}} + [rn/activity-indicator]]) + [rn/view + {:style (merge (content-style type) + (when loading + {:opacity 0}))} + (cond + (= type :icon) + [icons/icon children {:color icon-color}] - (string? children) - [text/text - {:weight :medium - :number-of-lines 1 - :style {:color text-color}} - children] + (string? children) + [text/text + {:weight :medium + :number-of-lines 1 + :style {:color text-color}} + children] - (vector? children) - children)] - (when after - [rn/view - [icons/icon after {:color icon-color}]])]])) + (vector? children) + children)] + (when after + [rn/view + [icons/icon after {:color icon-color}]])]]])) diff --git a/src/status_im/ui/components/controls/view.cljs b/src/status_im/ui/components/controls/view.cljs index 5d0b380f717..2aadba8da4a 100644 --- a/src/status_im/ui/components/controls/view.cljs +++ b/src/status_im/ui/components/controls/view.cljs @@ -1,67 +1,30 @@ (ns status-im.ui.components.controls.view - (:require [cljs-bean.core :as bean] - [react-native.reanimated :as animated] - [status-im.ui.components.controls.styles :as styles] + (:require [status-im.ui.components.controls.styles :as styles] [status-im.ui.components.colors :as colors] [react-native.core :as rn] - [reagent.core :as reagent] [status-im.ui.components.icons.icons :as icons])) -(defn control-builder - [component] - (fn [props] - (let [{:keys [value onChange disabled]} - (bean/bean props)] - (reagent/as-element - [rn/touchable-without-feedback - {:on-press (fn [] - (when (and (not disabled) onChange) - (onChange (not value)))) - :enabled (boolean (and onChange (not disabled)))} - [rn/view - [component - {:disabled disabled}]]])))) - -(defn switch-view - [{:keys [transition hold disabled value]}] - [animated/view - {:style (styles/switch-style transition disabled) +(defn switch + [{:keys [disabled value]}] + [rn/view + {:style (styles/switch-style value disabled) :accessibility-label (str "switch-" (if value "on" "off")) :accessibility-role :switch} - [animated/view {:style (styles/switch-bullet-style transition hold)}]]) + [rn/view {:style (styles/switch-bullet-style value false)}]]) -(defn radio-view - [{:keys [transition hold disabled value]}] - [animated/view - {:style (styles/radio-style transition disabled) +(defn radio + [{:keys [disabled value]}] + [rn/view + {:style (styles/radio-style value disabled) :accessibility-label (str "radio-" (if value "on" "off")) :accessibility-role :radio} - [animated/view {:style (styles/radio-bullet-style transition hold)}]]) - -(defn checkbox-view - [props] - (let [{:keys [value onChange disabled]} (bean/bean props)] - (reagent/as-element - [rn/touchable-without-feedback - {:on-press (when (and onChange (not disabled)) onChange)} - [rn/view - {:style (styles/checkbox-style value disabled) - :accessibility-label (str "checkbox-" (if value "on" "off")) - :accessibility-role :checkbox} - [rn/view {:style (styles/check-icon-style value)} - [icons/tiny-icon :tiny-icons/tiny-check {:color colors/white}]]]]))) + [rn/view {:style (styles/radio-bullet-style value false)}]]) -(defn animated-checkbox-view - [{:keys [transition hold disabled value]}] - [animated/view - {:style (styles/animated-checkbox-style transition disabled) +(defn checkbox + [{:keys [value disabled]}] + [rn/view + {:style (styles/checkbox-style value disabled) :accessibility-label (str "checkbox-" (if value "on" "off")) :accessibility-role :checkbox} - [animated/view {:style (styles/animated-check-icon-style transition hold)} + [rn/view {:style (styles/check-icon-style value)} [icons/tiny-icon :tiny-icons/tiny-check {:color colors/white}]]]) - -(def switch (reagent/adapt-react-class (control-builder switch-view))) -(def radio (reagent/adapt-react-class (control-builder radio-view))) -(def animated-checkbox - (reagent/adapt-react-class (control-builder animated-checkbox-view))) -(def checkbox (reagent/adapt-react-class checkbox-view)) diff --git a/src/status_im/ui/components/list/item.cljs b/src/status_im/ui/components/list/item.cljs index f71087b1baa..f2f6bccbb86 100644 --- a/src/status_im/ui/components/list/item.cljs +++ b/src/status_im/ui/components/list/item.cljs @@ -172,7 +172,7 @@ [title-column props]]) (defn right-side - [{:keys [chevron active disabled accessory accessory-text accessory-style animated-accessory?]}] + [{:keys [chevron active disabled accessory accessory-text accessory-style]}] (when (or chevron accessory) [rn/view {:style (merge {:align-items :center @@ -191,10 +191,7 @@ [rn/view {:style (:tiny spacing/padding-horizontal)} (case accessory :radio [controls/radio {:value active :disabled disabled}] - :checkbox [(if animated-accessory? - controls/animated-checkbox - controls/checkbox) - {:value active :disabled disabled}] + :checkbox [controls/checkbox {:value active :disabled disabled}] :switch [controls/switch {:value active :disabled disabled}] :text [text/text {:color :secondary