fix new chat button is not visible in small screen devices (#15079)

This commit is contained in:
Parvesh Monu 2023-02-14 16:57:30 +05:30 committed by GitHub
parent cdada3fa23
commit 5e87d7eefd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 34 deletions

View File

@ -16,6 +16,7 @@
:justify-content :center :justify-content :center
:align-items :center}) :align-items :center})
(defn chat-button (def chat-button
[{:keys [bottom]}] {:position :absolute
{:bottom (- bottom 50)}) :bottom 30
:align-self :center})

View File

@ -6,14 +6,12 @@
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im2.constants :as constants] [status-im2.constants :as constants]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.ui.components.react :as react] [react-native.core :as rn]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.ui.components.toolbar :as toolbar]
[status-im2.common.contact-list.view :as contact-list] [status-im2.common.contact-list.view :as contact-list]
[quo2.components.markdown.text :as text] [quo2.components.markdown.text :as text]
[status-im.ui.components.invite.events :as invite.events] [status-im.ui.components.invite.events :as invite.events]
[status-im.ui2.screens.chat.components.new-chat.styles :as style] [status-im.ui2.screens.chat.components.new-chat.styles :as style]
[quo.components.safe-area :as safe-area]
[status-im.react-native.resources :as resources])) [status-im.react-native.resources :as resources]))
(defn- hide-sheet-and-dispatch (defn- hide-sheet-and-dispatch
@ -33,11 +31,11 @@
(defn- no-contacts-view (defn- no-contacts-view
[] []
[react/view [rn/view
{:style {:justify-content :center {:style {:justify-content :center
:align-items :center :align-items :center
:margin-top 120}} :margin-top 120}}
[react/image [rn/image
{:source (resources/get-image (if (quo2.colors/dark?) :no-contacts-dark :no-contacts))}] {:source (resources/get-image (if (quo2.colors/dark?) :no-contacts-dark :no-contacts))}]
[text/text [text/text
{:weight :semi-bold {:weight :semi-bold
@ -74,9 +72,8 @@
added? (reagent/atom '()) added? (reagent/atom '())
{:keys [nickname ens-name three-words-name]} names {:keys [nickname ens-name three-words-name]} names
first-username (or ens-name nickname three-words-name) first-username (or ens-name nickname three-words-name)
no-contacts? (empty? contacts) no-contacts? (empty? contacts)]
safe-area (safe-area/use-safe-area)] [rn/view {:style {:height (* window-height 0.9)}}
[react/view {:style {:height (* window-height 0.9)}}
[quo2/button [quo2/button
{:type :grey {:type :grey
:icon true :icon true
@ -85,7 +82,7 @@
:override-background-color (quo2.colors/theme-colors quo2.colors/neutral-10 :override-background-color (quo2.colors/theme-colors quo2.colors/neutral-10
quo2.colors/neutral-90)} quo2.colors/neutral-90)}
:i/close] :i/close]
[react/view style/contact-selection-heading [rn/view style/contact-selection-heading
[quo2/text [quo2/text
{:weight :semi-bold {:weight :semi-bold
:size :heading-1 :size :heading-1
@ -99,9 +96,8 @@
(i18n/label :t/selected-count-from-max (i18n/label :t/selected-count-from-max
{:selected (inc selected-contacts-count) {:selected (inc selected-contacts-count)
:max constants/max-group-chat-participants})])] :max constants/max-group-chat-participants})])]
[react/view [rn/view
{:style {:height 430 {:style {:flex 1}}
:margin-bottom -20}}
(if no-contacts? (if no-contacts?
[no-contacts-view] [no-contacts-view]
[contact-list/contact-list [contact-list/contact-list
@ -110,21 +106,19 @@
:added? added? :added? added?
:search? false :search? false
:start-a-new-chat? true :start-a-new-chat? true
:on-toggle on-toggle}])] :on-toggle on-toggle}
70])]
(when contacts-selected? (when contacts-selected?
[toolbar/toolbar [button/button
{:size :default {:type :primary
:show-border? false :style style/chat-button
:center [button/button :accessibility-label :next-button
{:type :primary :on-press (fn []
:accessibility-label :next-button (if one-contact-selected?
:style (style/chat-button safe-area) (hide-sheet-and-dispatch [:chat.ui/start-chat
:on-press (fn [] public-key])
(if one-contact-selected? (hide-sheet-and-dispatch [:navigate-to
(hide-sheet-and-dispatch [:chat.ui/start-chat :new-group])))}
public-key]) (if one-contact-selected?
(hide-sheet-and-dispatch [:navigate-to (i18n/label :t/chat-with {:selected-user first-username})
:new-group])))} (i18n/label :t/setup-group-chat))])]))])
(if one-contact-selected?
(i18n/label :t/chat-with {:selected-user first-username})
(i18n/label :t/setup-group-chat))]}])]))])

View File

@ -9,7 +9,7 @@
[quo/divider-label {:label title}]) [quo/divider-label {:label title}])
(defn contact-list (defn contact-list
[data] [data padding-bottom]
(let [contacts (if (:group data) (let [contacts (if (:group data)
(rf/sub [:contacts/grouped-by-first-letter]) (rf/sub [:contacts/grouped-by-first-letter])
(rf/sub [:contacts/filtered-active-sections]))] (rf/sub [:contacts/filtered-active-sections]))]
@ -18,6 +18,6 @@
:sticky-section-headers-enabled false :sticky-section-headers-enabled false
:sections contacts :sections contacts
:render-section-header-fn contacts-section-header :render-section-header-fn contacts-section-header
:content-container-style {:padding-bottom 20} :content-container-style {:padding-bottom (or padding-bottom 20)}
:render-data data :render-data data
:render-fn contact-list-item/contact-list-item}])) :render-fn contact-list-item/contact-list-item}]))