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
|
||||
:color colors/danger-50}})
|
||||
|
||||
(defn text-input
|
||||
(defn text-input-container
|
||||
[error?]
|
||||
{: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
|
||||
{:padding-top 8
|
||||
{:style {:padding-top 1
|
||||
:padding-left 12
|
||||
:padding-right 12
|
||||
:padding-bottom 8
|
||||
:padding-right 7
|
||||
:padding-bottom 7
|
||||
:margin-right 10
|
||||
:flex 1
|
||||
:color (colors/theme-colors
|
||||
colors/black
|
||||
colors/white)
|
||||
:flex-direction :row
|
||||
:background-color (colors/theme-colors
|
||||
colors/white
|
||||
colors/neutral-95)
|
||||
|
@ -103,7 +92,33 @@
|
|||
colors/danger-50-opa-40
|
||||
(colors/theme-colors
|
||||
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
|
||||
[]
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
(ns status-im2.contexts.add-new-contact.views
|
||||
(:require [quo2.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.qr-scanner.core :as qr-scanner]
|
||||
[status-im2.contexts.add-new-contact.style :as style]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo2.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[react-native.clipboard :as clipboard]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.qr-scanner.core :as qr-scanner]
|
||||
[status-im2.contexts.add-new-contact.style :as style]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn new-contact
|
||||
[]
|
||||
|
@ -34,13 +37,20 @@
|
|||
[quo/text (style/text-description)
|
||||
(i18n/label :t/ens-or-chat-key)]
|
||||
[rn/view style/container-text-input
|
||||
[rn/text-input
|
||||
(merge (style/text-input error?)
|
||||
{:default-value input
|
||||
:placeholder (i18n/label :t/type-some-chat-key)
|
||||
:on-change-text #(debounce/debounce-and-dispatch
|
||||
[:contacts/set-new-identity %]
|
||||
600)})]
|
||||
[rn/view (style/text-input-container error?)
|
||||
[rn/text-input
|
||||
(merge (style/text-input)
|
||||
{:default-value input
|
||||
:placeholder (i18n/label :t/type-some-chat-key)
|
||||
:on-change-text #(debounce/debounce-and-dispatch
|
||||
[:contacts/set-new-identity %]
|
||||
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
|
||||
(merge style/button-qr
|
||||
{:on-press #(rf/dispatch [::qr-scanner/scan-code
|
||||
|
|
Loading…
Reference in New Issue