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,23 +25,26 @@
|
||||||
(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/text-input (merge {:placeholder placeholder}
|
[react/view
|
||||||
(when placeholder-text-color {:placeholder-text-color placeholder-text-color})
|
[react/text-input (merge {:placeholder placeholder}
|
||||||
(when selection-color {:selection-color selection-color})
|
(when placeholder-text-color {:placeholder-text-color placeholder-text-color})
|
||||||
(when style {:style style})
|
(when selection-color {:selection-color selection-color})
|
||||||
(when keyboard-type {:keyboard-type keyboard-type})
|
(when style {:style style})
|
||||||
(when auto-focus {:auto-focus auto-focus})
|
(when keyboard-type {:keyboard-type keyboard-type})
|
||||||
(when default-value {:default-value default-value})
|
(when auto-focus {:auto-focus auto-focus})
|
||||||
(when on-submit
|
(when default-value {:default-value default-value})
|
||||||
{:on-submit-editing #(on-submit {})})
|
(when on-submit
|
||||||
(when on-change
|
{:on-submit-editing #(on-submit {})})
|
||||||
{:on-change-text
|
(when on-change
|
||||||
(if change-delay
|
{:on-change-text
|
||||||
(let [current (atom nil)]
|
(if change-delay
|
||||||
#(on-input-change-text-delay current on-change % change-delay))
|
(let [current (atom nil)]
|
||||||
#(on-input-change-text on-change %))}))])
|
#(on-input-change-text-delay current on-change % change-delay))
|
||||||
|
#(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