diff --git a/src/status_im/chat/views/input/suggestions.cljs b/src/status_im/chat/views/input/suggestions.cljs index 9be43b8279..4cfdb60cf1 100644 --- a/src/status_im/chat/views/input/suggestions.cljs +++ b/src/status_im/chat/views/input/suggestions.cljs @@ -17,35 +17,21 @@ :number-of-lines 2} description]]]) -(defview response-item [{:keys [name description] - {:keys [message-id]} :request :as command} last?] - [{{:keys [params]} :content} [:get-current-chat-message message-id]] - [suggestion-item - {:on-press #(let [metadata (assoc params :to-message-id message-id)] - (re-frame/dispatch [:select-chat-input-command command metadata])) - :name (commands-model/command-name command) - :description description - :last? last?}]) - -(defn command-item [{:keys [name description bot] :as command} last?] - [suggestion-item - {:on-press #(re-frame/dispatch [:select-chat-input-command command nil]) - :name (commands-model/command-name command) - :description description - :last? last?}]) - (defview suggestions-view [] - (letsubs [responses [:get-available-responses] - commands [:get-available-commands]] - [expandable/expandable-view {:key :suggestions} + (letsubs [commands [:get-available-commands]] + [expandable/expandable-view {:key :suggestions + :draggable? false + :height (* (count commands) + (+ style/item-height + style/border-height)) + :dynamic-height? true} [react/view [react/scroll-view {:keyboard-should-persist-taps :always :bounces false} - (when (seq responses) - (for [[i response] (map-indexed vector responses)] - ^{:key i} - [response-item response (= i (dec (count responses)))])) (when (seq commands) - (for [[i command] (map-indexed vector commands)] + (for [[i {:keys [description] :as command}] (map-indexed vector commands)] ^{:key i} - [command-item command (= i (dec (count commands)))]))]]])) + [suggestion-item {:on-press #(re-frame/dispatch [:select-chat-input-command command nil]) + :name (commands-model/command-name command) + :description description + :last? (= i (dec (count commands)))}]))]]]))