[#12919] Allowing adding emoji in status input even if it exceeds limit

This commit is contained in:
Roman Volosovskyi 2022-01-17 10:47:44 +02:00
parent 826dd32c40
commit c44e5bbb67
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 15 additions and 7 deletions

View File

@ -12,7 +12,8 @@
[status-im.ui.components.icons.icons :as icons]
[quo.components.animated.pressable :as pressable]
[status-im.ui.screens.status.views :as status.views]
[status-im.ui.screens.status.new.styles :as styles]))
[status-im.ui.screens.status.new.styles :as styles]
[status-im.utils.platform :as platform]))
(defn buttons []
[react/view styles/buttons
@ -43,7 +44,7 @@
^{:key (str "image" img)}
[image-preview img])]]))
(def message-max-lenght 600)
(def message-max-length 600)
(defn my-status []
(let [images-opened (reagent/atom false)
@ -53,7 +54,8 @@
input-text (re-frame/subscribe [:chats/timeline-chat-input-text])
sending-image (re-frame/subscribe [:chats/timeline-sending-image])]
(fn []
(let [{:keys [uri]} (first (vals @sending-image))]
(let [{:keys [uri]} (first (vals @sending-image))
text-length (count @input-text)]
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
[:<>
[react/scroll-view {:style {:flex 1}
@ -65,7 +67,10 @@
{:style {:margin 16}
:scroll-enabled false
:accessibility-label :my-status-input
:max-length message-max-lenght
:max-length (if platform/android?
message-max-length
(when (>= text-length message-max-length)
text-length))
:auto-focus true
:multiline true
:on-selection-change (fn [args]
@ -100,11 +105,14 @@
{:accessibility-label :send-my-status-button
:type :secondary
:after :main-icon/send
:disabled (and (string/blank? @input-text) (not uri))
:disabled (or (> text-length message-max-length)
(and (string/blank? @input-text) (not uri)))
:on-press #(do
(re-frame/dispatch [:profile.ui/send-my-status-message])
(re-frame/dispatch [:navigate-back]))}
(i18n/label :t/wallet-send)]}]
[react/view styles/count-container
[react/text {:style {:color colors/gray}}
(str (count @input-text) " / " message-max-lenght)]]]]]]))))
[react/text {:style {:color (if (> text-length message-max-length)
colors/red
colors/gray)}}
(str text-length " / " message-max-length)]]]]]]))))