fix inability to move cursor to next line in bio field (#20403)
This commit is contained in:
parent
874906b11f
commit
df939bf85f
|
@ -4,7 +4,6 @@
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
[react-native.safe-area :as safe-area]
|
[react-native.safe-area :as safe-area]
|
||||||
[reagent.core :as reagent]
|
|
||||||
[status-im.common.validation.profile :as profile-validator]
|
[status-im.common.validation.profile :as profile-validator]
|
||||||
[status-im.constants :as constants]
|
[status-im.constants :as constants]
|
||||||
[status-im.contexts.profile.edit.bio.style :as style]
|
[status-im.contexts.profile.edit.bio.style :as style]
|
||||||
|
@ -18,20 +17,19 @@
|
||||||
profile (rf/sub [:profile/profile-with-image])
|
profile (rf/sub [:profile/profile-with-image])
|
||||||
customization-color (rf/sub [:profile/customization-color])
|
customization-color (rf/sub [:profile/customization-color])
|
||||||
alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
|
alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
|
||||||
profile-bio (:bio profile)
|
current-bio (:bio profile)
|
||||||
unsaved-bio (reagent/atom profile-bio)
|
[bio set-bio] (rn/use-state current-bio)
|
||||||
error-msg (reagent/atom nil)
|
[error-msg set-error-msg] (rn/use-state nil)
|
||||||
typing? (reagent/atom false)
|
[typing? set-typing] (rn/use-state false)
|
||||||
validate-bio (debounce/debounce (fn [bio]
|
validate-bio (debounce/debounce (fn [bio]
|
||||||
(reset! error-msg
|
(set-error-msg (profile-validator/validation-bio
|
||||||
(profile-validator/validation-bio bio))
|
bio))
|
||||||
(reset! typing? false))
|
(set-typing false))
|
||||||
300)
|
300)
|
||||||
on-change-text (fn [s]
|
on-change-text (fn [s]
|
||||||
(reset! typing? true)
|
(set-typing true)
|
||||||
(reset! unsaved-bio s)
|
(set-bio s)
|
||||||
(validate-bio s))]
|
(validate-bio s))]
|
||||||
(fn []
|
|
||||||
[quo/overlay
|
[quo/overlay
|
||||||
{:type :shell
|
{:type :shell
|
||||||
:container-style (style/page-wrapper insets)}
|
:container-style (style/page-wrapper insets)}
|
||||||
|
@ -49,28 +47,29 @@
|
||||||
[quo/input
|
[quo/input
|
||||||
{:blur? true
|
{:blur? true
|
||||||
:multiline? true
|
:multiline? true
|
||||||
:error? (not (string/blank? @error-msg))
|
:error? (not (string/blank? error-msg))
|
||||||
:container-style {:margin-bottom -11}
|
:container-style {:margin-bottom -11}
|
||||||
:default-value @unsaved-bio
|
:default-value bio
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
|
:max-height 200
|
||||||
:char-limit constants/profile-bio-max-length
|
:char-limit constants/profile-bio-max-length
|
||||||
:label (i18n/label :t/profile-bio)
|
:label (i18n/label :t/profile-bio)
|
||||||
:placeholder (i18n/label :t/something-about-you)
|
:placeholder (i18n/label :t/something-about-you)
|
||||||
:on-change-text on-change-text}]
|
:on-change-text on-change-text}]
|
||||||
(when-not (string/blank? @error-msg)
|
(when-not (string/blank? error-msg)
|
||||||
[quo/info-message
|
[quo/info-message
|
||||||
{:type :error
|
{:type :error
|
||||||
:size :default
|
:size :default
|
||||||
:icon :i/info}
|
:icon :i/info}
|
||||||
@error-msg])]
|
error-msg])]
|
||||||
[rn/view {:style style/button-wrapper}
|
[rn/view {:style style/button-wrapper}
|
||||||
[quo/button
|
[quo/button
|
||||||
{:type :primary
|
{:type :primary
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:profile/edit-bio @unsaved-bio]))
|
(rf/dispatch [:profile/edit-bio bio]))
|
||||||
:disabled? (boolean (or @typing?
|
:disabled? (boolean (or typing?
|
||||||
(and (string/blank? profile-bio)
|
(and (string/blank? current-bio)
|
||||||
(string/blank? @unsaved-bio))
|
(string/blank? bio))
|
||||||
(not (string/blank? @error-msg))))}
|
(not (string/blank? error-msg))))}
|
||||||
(i18n/label :t/save-bio)]]]])))
|
(i18n/label :t/save-bio)]]]]))
|
||||||
|
|
Loading…
Reference in New Issue