[#8548] No 'Paste' native Android option on longtap in the app input fields (conract-code, wallet recipient address etc)

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2019-08-20 16:35:08 +03:00
parent 5cafef6702
commit ad0e0663f6
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
5 changed files with 38 additions and 29 deletions

View File

@ -11,13 +11,17 @@
[status-im.ui.components.toolbar.view :as toolbar.view]
[status-im.ui.screens.add-new.styles :as add-new.styles]
[status-im.ui.screens.add-new.new-chat.styles :as styles]
[status-im.utils.platform :as platform]))
[status-im.utils.platform :as platform]
[reagent.core :as reagent]))
(defn- render-row [row _ _]
[contact-view/contact-view {:contact row
:on-press #(re-frame/dispatch [:chat.ui/start-chat (:public-key %) {:navigation-reset? true}])
:show-forward? true}])
;;TODO workaround for https://github.com/facebook/react-native/issues/23653 (https://github.com/status-im/status-react/issues/8548)
(def tw (reagent/atom "95%"))
(views/defview new-chat []
(views/letsubs [contacts [:contacts/active]
error-message [:new-identity-error]]
@ -26,11 +30,12 @@
[toolbar.view/simple-toolbar (i18n/label :t/new-chat)]
[react/view add-new.styles/new-chat-container
[react/view add-new.styles/new-chat-input-container
[react/text-input {:on-change-text #(re-frame/dispatch [:new-chat/set-new-identity %])
[react/text-input {:ref (fn [v] (js/setTimeout #(reset! tw (if v "100%" "95%")) 100))
:on-change-text #(re-frame/dispatch [:new-chat/set-new-identity %])
:on-submit-editing #(when-not error-message
(re-frame/dispatch [:contact.ui/contact-code-submitted]))
:placeholder (i18n/label :t/enter-contact-code)
:style add-new.styles/input
:style (add-new.styles/input @tw)
:accessibility-label :enter-contact-code-input
:return-key-type :go}]]
(when-not platform/desktop?

View File

@ -1,5 +1,5 @@
(ns status-im.ui.screens.add-new.styles
(:require-macros [status-im.utils.styles :refer [defstyle]])
(:require-macros [status-im.utils.styles :refer [defstyle defnstyle]])
(:require [status-im.ui.components.colors :as colors]
[status-im.ui.components.styles :as styles]))
@ -33,9 +33,9 @@
:margin-left 3
:margin-top 24})
(defstyle input
{:flex 1
:padding-horizontal 14
(defnstyle input [w]
{:padding-horizontal 14
:width w
:desktop {:height 30
:width "100%"}
:android {:padding 0}})

View File

@ -28,7 +28,7 @@
:on-change-text #(re-frame/dispatch [:set :new-chat-name %])
:default-value new-group-name
:placeholder (i18n/label :t/set-a-topic)
:style add-new.styles/input
:style (add-new.styles/input "100%")
:accessibility-label :chat-name-input}]])
(defn- render-contact [contact]

View File

@ -45,11 +45,12 @@
:padding-top 0
:height 52}))
(def contact-code-text-input
(defn contact-code-text-input [w]
{:text-align-vertical :top
:padding-top 16
:padding-left 2
:padding-right 8
:width w
:height 72})
(def label

View File

@ -235,26 +235,29 @@
:key-fn :address
:render-fn render-account}]]]))
(defn contact-code []
(let [content (reagent/atom nil)]
(fn []
[simple-screen {:avoid-keyboard? true}
[toolbar {:style {:border-bottom-color colors/white-transparent-10}}
default-action
(i18n/label :t/recipient)]
[react/view components.styles/flex
[cartouche {}
(i18n/label :t/recipient)
[text-input {:multiline true
:style styles/contact-code-text-input
:placeholder (i18n/label :t/recipient-code)
:on-change-text #(reset! content %)
:accessibility-label :recipient-address-input}]]
[bottom-buttons/bottom-button
[button/button {:disabled? (string/blank? @content)
:on-press #(re-frame/dispatch [:wallet.send/set-recipient @content])
:fit-to-text? false}
(i18n/label :t/done)]]]])))
;;TODO workaround for https://github.com/facebook/react-native/issues/23653 (https://github.com/status-im/status-react/issues/8548)
(def tw (reagent/atom "95%"))
(views/defview contact-code []
(views/letsubs [content (reagent/atom nil)]
[simple-screen {:avoid-keyboard? true}
[toolbar {:style {:border-bottom-color colors/white-transparent-10}}
default-action
(i18n/label :t/recipient)]
[react/view components.styles/flex
[cartouche {}
(i18n/label :t/recipient)
[text-input {:ref (fn [v] (js/setTimeout #(reset! tw (if v "100%" "95%")) 100))
:multiline true
:style (styles/contact-code-text-input @tw)
:placeholder (i18n/label :t/recipient-code)
:on-change-text #(reset! content %)
:accessibility-label :recipient-address-input}]]
[bottom-buttons/bottom-button
[button/button {:disabled? (string/blank? @content)
:on-press #(re-frame/dispatch [:wallet.send/set-recipient @content])
:fit-to-text? false}
(i18n/label :t/done)]]]]))
(defn recipient-qr-code []
[choose-recipient/choose-recipient])