[Fix] "View Profile" button behaviour on keyboard open in "Add a contact" modal (#15978)

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2023-05-26 03:02:45 +08:00 committed by GitHub
parent 682eb841ff
commit e14ed7a637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 63 deletions

View File

@ -1,11 +1,12 @@
(ns status-im2.contexts.add-new-contact.style (ns status-im2.contexts.add-new-contact.style
(:require [quo2.foundations.colors :as colors] (:require [quo2.foundations.colors :as colors]
[quo2.foundations.typography :as typography]
[react-native.platform :as platform] [react-native.platform :as platform]
[quo2.foundations.typography :as typography])) [react-native.safe-area :as safe-area]))
(defn container-outer (defn container-outer
[] []
{:style {:flex (if platform/ios? 4.5 5) {:style {:flex 1
:background-color (colors/theme-colors colors/white colors/neutral-95) :background-color (colors/theme-colors colors/white colors/neutral-95)
:justify-content :space-between :justify-content :space-between
:align-items :center :align-items :center
@ -171,7 +172,7 @@
:size 40 :size 40
:width 335 :width 335
:style {:margin-top 24 :style {:margin-top 24
:margin-bottom 24} :margin-bottom (+ (safe-area/get-bottom) 12)}
:accessibility-label :new-contact-button :accessibility-label :new-contact-button
:before :i/profile :before :i/profile
:disabled (not= state :valid)}) :disabled (not= state :valid)})

View File

@ -51,7 +51,10 @@
show-paste-button? (and (not (string/blank? @clipboard)) show-paste-button? (and (not (string/blank? @clipboard))
(string/blank? @default-value) (string/blank? @default-value)
(string/blank? input))] (string/blank? input))]
[rn/keyboard-avoiding-view
{:style {:flex 1}}
[rn/touchable-without-feedback
{:on-press rn/dismiss-keyboard!}
[rn/view (style/container-outer) [rn/view (style/container-outer)
[rn/view style/container-inner [rn/view style/container-inner
[quo/button [quo/button
@ -78,7 +81,9 @@
(reset! default-value v) (reset! default-value v)
(debounce/debounce-and-dispatch (debounce/debounce-and-dispatch
[:contacts/set-new-identity v nil] [:contacts/set-new-identity v nil]
600))})] 600))
:blur-on-submit true
:return-key-type :done})]
(when show-paste-button? (when show-paste-button?
[quo/button [quo/button
(merge style/button-paste (merge style/button-paste
@ -101,7 +106,6 @@
(i18n/label (or msg :t/invalid-ens-or-key))]]) (i18n/label (or msg :t/invalid-ens-or-key))]])
(when (= state :valid) (when (= state :valid)
[found-contact public-key])] [found-contact public-key])]
[rn/view
[quo/button [quo/button
(merge (style/button-view-profile state) (merge (style/button-view-profile state)
{:on-press {:on-press
@ -111,4 +115,4 @@
(rf/dispatch [:contacts/clear-new-identity]) (rf/dispatch [:contacts/clear-new-identity])
(rf/dispatch [:navigate-back]) (rf/dispatch [:navigate-back])
(rf/dispatch [:chat.ui/show-profile public-key ens]))}) (rf/dispatch [:chat.ui/show-profile public-key ens]))})
(i18n/label :t/view-profile)]]])))) (i18n/label :t/view-profile)]]]]))))