- seed-phrase field should not enable autofill

- make hide/show password work on Android

Signed-off-by: Michele Balistreri <michele@bitgamma.com>
This commit is contained in:
Michele Balistreri 2021-09-02 11:33:13 +03:00
parent 08cae71390
commit 2bd4957569
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
5 changed files with 27 additions and 12 deletions

View File

@ -146,7 +146,7 @@
(fn [{:keys [label multiline error style input-style keyboard-type before after (fn [{:keys [label multiline error style input-style keyboard-type before after
cancel-label on-focus on-blur show-cancel accessibility-label cancel-label on-focus on-blur show-cancel accessibility-label
bottom-value secure-text-entry container-style get-ref on-cancel bottom-value secure-text-entry container-style get-ref on-cancel
monospace] monospace auto-complete-type auto-correct]
:or {cancel-label "Cancel"} :or {cancel-label "Cancel"}
:as props}] :as props}]
{:pre [(check-spec ::text-input props)]} {:pre [(check-spec ::text-input props)]}
@ -164,19 +164,30 @@
:on-press #(reset! visible true)} :on-press #(reset! visible true)}
:else after) :else after)
secure (and (true? secure-text-entry) secure (and secure-text-entry (not @visible))
(or platform/android? (not @visible))) auto-complete (cond
(= keyboard-type :visible-password)
:off
secure-text-entry
:password
:else
auto-complete-type)
auto-correct (and (not= keyboard-type :visible-password) (not secure-text-entry) auto-correct)
on-cancel (fn [] on-cancel (fn []
(when on-cancel (when on-cancel
(on-cancel)) (on-cancel))
(blur)) (blur))
keyboard-type (cond keyboard-type (cond
(and platform/ios? (= keyboard-type "visible-password")) (and platform/ios? (= keyboard-type :visible-password))
"default" :default
;; NOTE: Now switching dynamically brakes android input ; the correct approach on Android would be keep secure-text-entry on set keyboard type
(and platform/android? secure-text-entry @visible) ; to visible-password. But until https://github.com/facebook/react-native/issues/27946
"visible-password" ; is solved that's the second best way.
(and platform/android? secure-text-entry)
:default
:else :else
keyboard-type)] keyboard-type)]
@ -200,6 +211,8 @@
:underline-color-android :transparent :underline-color-android :transparent
:auto-capitalize :none :auto-capitalize :none
:secure-text-entry secure :secure-text-entry secure
:auto-correct auto-correct
:auto-complete-type auto-complete
:on-focus (fn [evt] :on-focus (fn [evt]
(when on-focus (on-focus evt)) (when on-focus (on-focus evt))
(when show-cancel (when show-cancel
@ -215,7 +228,7 @@
{:clear-button-mode :while-editing}) {:clear-button-mode :while-editing})
(dissoc props (dissoc props
:style :keyboard-type :on-focus :on-blur :style :keyboard-type :on-focus :on-blur
:secure-text-entry :ref :get-ref))] :secure-text-entry :ref :get-ref :auto-correct :auto-complete-type))]
(when after (when after
[accessory-element after])] [accessory-element after])]
(when (and show-cancel (when (and show-cancel

View File

@ -64,6 +64,7 @@
[quo/text-input [quo/text-input
{:show-cancel false {:show-cancel false
:auto-correct false :auto-correct false
:keyboard-type :visible-password
:placeholder (i18n/label :t/seed-phrase-placeholder) :placeholder (i18n/label :t/seed-phrase-placeholder)
:monospace true :monospace true
:multiline true :multiline true

View File

@ -94,6 +94,7 @@
:bottom-value 40 :bottom-value 40
:multiline true :multiline true
:auto-correct false :auto-correct false
:keyboard-type :visible-password
:monospace true}] :monospace true}]
[react/view {:align-items :flex-end} [react/view {:align-items :flex-end}
[react/view {:flex-direction :row [react/view {:flex-direction :row

View File

@ -104,7 +104,7 @@
(i18n/label :t/word-n {:number (inc idx)})]] (i18n/label :t/word-n {:number (inc idx)})]]
:auto-focus true :auto-focus true
:auto-correct false :auto-correct false
:keyboard-type "visible-password" :keyboard-type :visible-password
:monospace true :monospace true
:on-change-text #(re-frame/dispatch [:set-in [:my-profile/seed :word] %]) :on-change-text #(re-frame/dispatch [:set-in [:my-profile/seed :word] %])
:on-submit-editing next-handler :on-submit-editing next-handler

View File

@ -87,7 +87,7 @@
:auto-focus false :auto-focus false
:placeholder (i18n/label :t/multiaccounts-recover-enter-phrase-title) :placeholder (i18n/label :t/multiaccounts-recover-enter-phrase-title)
:auto-correct false :auto-correct false
:keyboard-type "visible-password" :keyboard-type :visible-password
:multiline true :multiline true
:height 95 :height 95
:error account-error :error account-error
@ -104,7 +104,7 @@
:auto-focus false :auto-focus false
:placeholder (i18n/label :t/enter-a-private-key) :placeholder (i18n/label :t/enter-a-private-key)
:auto-correct false :auto-correct false
:keyboard-type "visible-password" :keyboard-type :visible-password
:error account-error :error account-error
:secure-text-entry true :secure-text-entry true
:accessibility-label :add-account-enter-private-key :accessibility-label :add-account-enter-private-key