Audio button does not disappear when changed to 'Send' button #17082 (#17083)

This commit is contained in:
flexsurfer 2023-08-22 20:39:44 +02:00 committed by GitHub
parent 4dd5d88f0f
commit 8fe7fad540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 23 deletions

View File

@ -65,16 +65,16 @@
:i/arrow-up]]) :i/arrow-up]])
(defn send-button (defn send-button
[props {:keys [text-value] :as state} animations window-height images? edit] [props {:keys [text-value] :as state} animations window-height images? edit btn-opacity]
(let [btn-opacity (reanimated/use-shared-value 0) (let [z-index (reagent/atom (if (and (empty? @text-value) (not images?)) 0 1))]
z-index (reagent/atom (if (and (empty? @text-value) (not images?)) 0 1))]
[:f> f-send-button props state animations window-height images? btn-opacity z-index edit])) [:f> f-send-button props state animations window-height images? btn-opacity z-index edit]))
(defn disabled-audio-button (defn disabled-audio-button
[] [opacity]
[quo/composer-button [reanimated/view {:style (reanimated/apply-animations-to-style {:opacity opacity} {})}
{:on-press #(js/alert "to be implemented") [quo/composer-button
:icon :i/audio}]) {:on-press #(js/alert "to be implemented")
:icon :i/audio}]])
(defn audio-button (defn audio-button
[{:keys [record-reset-fn input-ref]} [{:keys [record-reset-fn input-ref]}
@ -169,8 +169,8 @@
[quo/composer-button [quo/composer-button
{:on-press #(go-to-camera images-count) {:on-press #(go-to-camera images-count)
:icon :i/camera :icon :i/camera
:container-style {:margin-right 12}} :container-style {:margin-right 12}}]))
]))
(defn open-photo-selector (defn open-photo-selector
[{:keys [input-ref]} [{:keys [input-ref]}
@ -212,16 +212,18 @@
(defn view (defn view
[props state animations window-height insets {:keys [edit images]}] [props state animations window-height insets {:keys [edit images]}]
[rn/view {:style style/actions-container} (let [send-btn-opacity (reanimated/use-shared-value 0)
[rn/view audio-btn-opacity (reanimated/interpolate send-btn-opacity [0 1] [1 0])]
{:style {:flex-direction :row [rn/view {:style style/actions-container}
:display (if @(:recording? state) :none :flex)}} [rn/view
[camera-button] {:style {:flex-direction :row
[image-button props animations insets] :display (if @(:recording? state) :none :flex)}}
[reaction-button] [camera-button]
[format-button]] [image-button props animations insets]
[:f> send-button props state animations window-height images edit] [reaction-button]
(when (and (not edit) (not images)) [format-button]]
;; TODO(alwx): needs to be replaced with an `audio-button` later. [:f> send-button props state animations window-height images edit send-btn-opacity]
;; See https://github.com/status-im/status-mobile/issues/16084 for more details. (when (and (not edit) (not images))
[disabled-audio-button])]) ;; TODO(alwx): needs to be replaced with an `audio-button` later.
;; See https://github.com/status-im/status-mobile/issues/16084 for more details.
[:f> disabled-audio-button audio-btn-opacity])]))

View File

@ -123,7 +123,7 @@
[gradients/view props state animations show-bottom-gradient?] [gradients/view props state animations show-bottom-gradient?]
[link-preview/view] [link-preview/view]
[images/images-list]])] [images/images-list]])]
[actions/view props state animations window-height insets subs]]]]])) [:f> actions/view props state animations window-height insets subs]]]]]))
(defn composer (defn composer
[insets] [insets]