adding error property on input component for extension
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
71852bf111
commit
e6bd5c5016
|
@ -8,6 +8,8 @@
|
||||||
[status-im.ui.components.checkbox.view :as checkbox]
|
[status-im.ui.components.checkbox.view :as checkbox]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors]
|
||||||
[status-im.ui.components.icons.vector-icons :as icons]
|
[status-im.ui.components.icons.vector-icons :as icons]
|
||||||
|
[status-im.ui.components.tooltip.views :as tooltip]
|
||||||
|
[status-im.ui.components.text-input.styles :as styles]
|
||||||
[status-im.extensions.capacities.map :as map-component]))
|
[status-im.extensions.capacities.map :as map-component]))
|
||||||
|
|
||||||
(defn button [{:keys [on-click enabled disabled] :as m} label]
|
(defn button [{:keys [on-click enabled disabled] :as m} label]
|
||||||
|
@ -23,8 +25,9 @@
|
||||||
(js/clearTimeout id))
|
(js/clearTimeout id))
|
||||||
(reset! current (js/setTimeout #(on-input-change-text on-change value) delay)))
|
(reset! current (js/setTimeout #(on-input-change-text on-change value) delay)))
|
||||||
|
|
||||||
(defn input [{:keys [keyboard-type style on-change change-delay placeholder placeholder-text-color selection-color
|
(defn input [{:keys [keyboard-type style error on-change change-delay placeholder placeholder-text-color selection-color
|
||||||
auto-focus on-submit default-value]}]
|
auto-focus on-submit default-value]}]
|
||||||
|
[react/view
|
||||||
[react/text-input (merge {:placeholder placeholder}
|
[react/text-input (merge {:placeholder placeholder}
|
||||||
(when placeholder-text-color {:placeholder-text-color placeholder-text-color})
|
(when placeholder-text-color {:placeholder-text-color placeholder-text-color})
|
||||||
(when selection-color {:selection-color selection-color})
|
(when selection-color {:selection-color selection-color})
|
||||||
|
@ -39,7 +42,9 @@
|
||||||
(if change-delay
|
(if change-delay
|
||||||
(let [current (atom nil)]
|
(let [current (atom nil)]
|
||||||
#(on-input-change-text-delay current on-change % change-delay))
|
#(on-input-change-text-delay current on-change % change-delay))
|
||||||
#(on-input-change-text on-change %))}))])
|
#(on-input-change-text on-change %))}))]
|
||||||
|
(when error
|
||||||
|
[tooltip/tooltip error (styles/error error)])])
|
||||||
|
|
||||||
(defn touchable-opacity [{:keys [style on-press]} & children]
|
(defn touchable-opacity [{:keys [style on-press]} & children]
|
||||||
(into [react/touchable-opacity (merge (when on-press {:on-press #(on-press {})})
|
(into [react/touchable-opacity (merge (when on-press {:on-press #(on-press {})})
|
||||||
|
@ -132,7 +137,7 @@
|
||||||
'touchable-opacity {:data touchable-opacity :properties {:on-press :event}}
|
'touchable-opacity {:data touchable-opacity :properties {:on-press :event}}
|
||||||
'icon {:data icon :properties {:key :keyword :color :any}}
|
'icon {:data icon :properties {:key :keyword :color :any}}
|
||||||
'image {:data image :properties {:uri :string :source :string}}
|
'image {:data image :properties {:uri :string :source :string}}
|
||||||
'input {:data input :properties {:on-change :event :placeholder :string :keyboard-type :keyword
|
'input {:data input :properties {:on-change :event :error :string :placeholder :string :keyboard-type :keyword
|
||||||
:change-delay? :number :placeholder-text-color :any :selection-color :any
|
:change-delay? :number :placeholder-text-color :any :selection-color :any
|
||||||
:auto-focus? :boolean :on-submit :event :default-value :any}}
|
:auto-focus? :boolean :on-submit :event :default-value :any}}
|
||||||
'button {:data button :properties {:enabled :boolean :disabled :boolean :on-click :event}}
|
'button {:data button :properties {:enabled :boolean :disabled :boolean :on-click :event}}
|
||||||
|
|
Loading…
Reference in New Issue