Paste button (#15002)
* Paste button * Lint fix * str -> string * Removing of redundant stuff * Style fixes * Style fixes * Style fixes (android) * Style fixes (android) * The last style fix * Styles * Lint fix
This commit is contained in:
parent
c4aef97a6d
commit
888bf12856
|
@ -74,26 +74,15 @@
|
||||||
:style {:margin-left 4
|
:style {:margin-left 4
|
||||||
:color colors/danger-50}})
|
:color colors/danger-50}})
|
||||||
|
|
||||||
(defn text-input
|
(defn text-input-container
|
||||||
[error?]
|
[error?]
|
||||||
{:accessibility-label :enter-contact-code-input
|
{:style {:padding-top 1
|
||||||
:auto-capitalize :none
|
|
||||||
:placeholder-text-color (colors/theme-colors
|
|
||||||
colors/neutral-40
|
|
||||||
colors/neutral-50)
|
|
||||||
:multiline true
|
|
||||||
:style
|
|
||||||
(merge typography/monospace
|
|
||||||
typography/paragraph-1
|
|
||||||
{:padding-top 8
|
|
||||||
:padding-left 12
|
:padding-left 12
|
||||||
:padding-right 12
|
:padding-right 7
|
||||||
:padding-bottom 8
|
:padding-bottom 7
|
||||||
:margin-right 10
|
:margin-right 10
|
||||||
:flex 1
|
:flex 1
|
||||||
:color (colors/theme-colors
|
:flex-direction :row
|
||||||
colors/black
|
|
||||||
colors/white)
|
|
||||||
:background-color (colors/theme-colors
|
:background-color (colors/theme-colors
|
||||||
colors/white
|
colors/white
|
||||||
colors/neutral-95)
|
colors/neutral-95)
|
||||||
|
@ -103,7 +92,33 @@
|
||||||
colors/danger-50-opa-40
|
colors/danger-50-opa-40
|
||||||
(colors/theme-colors
|
(colors/theme-colors
|
||||||
colors/neutral-20
|
colors/neutral-20
|
||||||
colors/neutral-80))})})
|
colors/neutral-80))}})
|
||||||
|
|
||||||
|
(defn text-input
|
||||||
|
[]
|
||||||
|
{:accessibility-label :enter-contact-code-input
|
||||||
|
:auto-capitalize :none
|
||||||
|
:placeholder-text-color (colors/theme-colors
|
||||||
|
colors/neutral-40
|
||||||
|
colors/neutral-50)
|
||||||
|
:multiline true
|
||||||
|
:style
|
||||||
|
(merge typography/monospace
|
||||||
|
typography/paragraph-1
|
||||||
|
{:flex 1
|
||||||
|
:margin-right 5
|
||||||
|
:margin-top (if platform/android?
|
||||||
|
4
|
||||||
|
0)
|
||||||
|
:padding 0
|
||||||
|
:color (colors/theme-colors
|
||||||
|
colors/black
|
||||||
|
colors/white)})})
|
||||||
|
|
||||||
|
(def button-paste
|
||||||
|
{:type :outline
|
||||||
|
:size 24
|
||||||
|
:style {:margin-top 6}})
|
||||||
|
|
||||||
(defn button-close
|
(defn button-close
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
(ns status-im2.contexts.add-new-contact.views
|
(ns status-im2.contexts.add-new-contact.views
|
||||||
(:require [quo2.core :as quo]
|
(:require
|
||||||
|
[clojure.string :as string]
|
||||||
|
[quo2.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
|
[react-native.clipboard :as clipboard]
|
||||||
[status-im.react-native.resources :as resources]
|
[status-im.react-native.resources :as resources]
|
||||||
[status-im.qr-scanner.core :as qr-scanner]
|
[status-im.qr-scanner.core :as qr-scanner]
|
||||||
[status-im2.contexts.add-new-contact.style :as style]
|
[status-im2.contexts.add-new-contact.style :as style]
|
||||||
|
@ -34,13 +37,20 @@
|
||||||
[quo/text (style/text-description)
|
[quo/text (style/text-description)
|
||||||
(i18n/label :t/ens-or-chat-key)]
|
(i18n/label :t/ens-or-chat-key)]
|
||||||
[rn/view style/container-text-input
|
[rn/view style/container-text-input
|
||||||
|
[rn/view (style/text-input-container error?)
|
||||||
[rn/text-input
|
[rn/text-input
|
||||||
(merge (style/text-input error?)
|
(merge (style/text-input)
|
||||||
{:default-value input
|
{:default-value input
|
||||||
:placeholder (i18n/label :t/type-some-chat-key)
|
:placeholder (i18n/label :t/type-some-chat-key)
|
||||||
:on-change-text #(debounce/debounce-and-dispatch
|
:on-change-text #(debounce/debounce-and-dispatch
|
||||||
[:contacts/set-new-identity %]
|
[:contacts/set-new-identity %]
|
||||||
600)})]
|
600)})]
|
||||||
|
(when (string/blank? input)
|
||||||
|
[quo/button
|
||||||
|
(merge style/button-paste
|
||||||
|
{:on-press (fn []
|
||||||
|
(clipboard/get-string #(rf/dispatch [:contacts/set-new-identity %])))})
|
||||||
|
(i18n/label :t/paste)])]
|
||||||
[quo/button
|
[quo/button
|
||||||
(merge style/button-qr
|
(merge style/button-qr
|
||||||
{:on-press #(rf/dispatch [::qr-scanner/scan-code
|
{:on-press #(rf/dispatch [::qr-scanner/scan-code
|
||||||
|
|
Loading…
Reference in New Issue