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

View File

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

View File

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

View File

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

View File

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