Disable scroll to the bottom button when composer is active.

This commit is contained in:
Ibrahem Khalil 2023-10-09 20:33:20 +03:00 committed by GitHub
parent 1770ff24ce
commit d4cc0189d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 30 deletions

View File

@ -18,7 +18,8 @@
{:keys [text-value focused? lock-selection? saved-cursor-position]} {:keys [text-value focused? lock-selection? saved-cursor-position]}
{:keys [height saved-height last-height opacity background-y container-opacity] {:keys [height saved-height last-height opacity background-y container-opacity]
:as animations} :as animations}
{:keys [max-height] :as dimensions}] {:keys [max-height] :as dimensions}
show-floating-scroll-down-button?]
(reset! focused? true) (reset! focused? true)
(rf/dispatch [:chat.ui/set-input-focused true]) (rf/dispatch [:chat.ui/set-input-focused true])
(reanimated/animate height (reanimated/get-shared-value last-height)) (reanimated/animate height (reanimated/get-shared-value last-height))
@ -31,7 +32,8 @@
(when (and (not-empty @text-value) @input-ref) (when (and (not-empty @text-value) @input-ref)
(.setNativeProps ^js @input-ref (.setNativeProps ^js @input-ref
(clj->js {:selection {:start @saved-cursor-position :end @saved-cursor-position}}))) (clj->js {:selection {:start @saved-cursor-position :end @saved-cursor-position}})))
(kb/handle-refocus-emoji-kb-ios props animations dimensions)) (kb/handle-refocus-emoji-kb-ios props animations dimensions)
(reset! show-floating-scroll-down-button? false))
(defn blur (defn blur
[{:keys [text-value focused? lock-selection? cursor-position saved-cursor-position gradient-z-index [{:keys [text-value focused? lock-selection? cursor-position saved-cursor-position gradient-z-index

View File

@ -47,7 +47,8 @@
:label (i18n/label :t/jump-to) :label (i18n/label :t/jump-to)
:style {:align-self :center}}} :style {:align-self :center}}}
{}]] {}]]
(when @show-floating-scroll-down-button? (when (and (not @focused?)
@show-floating-scroll-down-button?)
[quo/floating-shell-button [quo/floating-shell-button
{:scroll-to-bottom {:on-press scroll-to-bottom-fn}} {:scroll-to-bottom {:on-press scroll-to-bottom-fn}}
style/scroll-to-bottom-button])])) style/scroll-to-bottom-button])]))

View File

@ -105,34 +105,35 @@
:menu-items @(:menu-items state) :menu-items @(:menu-items state)
:style (style/input-view state)} :style (style/input-view state)}
[rn/text-input [rn/text-input
{:ref #(reset! (:input-ref props) %) {:ref #(reset! (:input-ref props) %)
:default-value @(:text-value state) :default-value @(:text-value state)
:on-focus #(handler/focus props state animations dimensions) :on-focus
:on-blur #(handler/blur state animations dimensions subscriptions) #(handler/focus props state animations dimensions show-floating-scroll-down-button?)
:on-content-size-change #(handler/content-size-change % :on-blur #(handler/blur state animations dimensions subscriptions)
state :on-content-size-change #(handler/content-size-change %
animations state
subscriptions animations
dimensions subscriptions
(or keyboard-shown dimensions
(:edit subscriptions))) (or keyboard-shown
:on-scroll #(handler/scroll % props state animations dimensions) (:edit subscriptions)))
:on-change-text #(handler/change-text % props state) :on-scroll #(handler/scroll % props state animations dimensions)
:on-selection-change #(handler/selection-change % props state) :on-change-text #(handler/change-text % props state)
:on-selection #(selection/on-selection % props state) :on-selection-change #(handler/selection-change % props state)
:keyboard-appearance (quo.theme/theme-value :light :dark) :on-selection #(selection/on-selection % props state)
:max-height max-height :keyboard-appearance (quo.theme/theme-value :light :dark)
:max-height max-height
:max-font-size-multiplier 1 :max-font-size-multiplier 1
:multiline true :multiline true
:placeholder (i18n/label :t/type-something) :placeholder (i18n/label :t/type-something)
:placeholder-text-color (colors/theme-colors colors/neutral-30 colors/neutral-50) :placeholder-text-color (colors/theme-colors colors/neutral-30 colors/neutral-50)
:style (style/input-text props :style (style/input-text props
state state
subscriptions subscriptions
{:max-height max-height {:max-height max-height
:theme theme}) :theme theme})
:max-length constants/max-text-size :max-length constants/max-text-size
:accessibility-label :chat-message-input}]] :accessibility-label :chat-message-input}]]
(when chat-screen-loaded? (when chat-screen-loaded?
[:<> [:<>
[gradients/view props state animations show-bottom-gradient?] [gradients/view props state animations show-bottom-gradient?]