From ed050f30a6f75bdeff83b76e9c87e753cffa3105 Mon Sep 17 00:00:00 2001 From: bitsikka Date: Fri, 21 Jun 2019 14:33:04 +0545 Subject: [PATCH] [8452] remove scroll-view hack Signed-off-by: Andrey Shovkoplyas --- .../ui/screens/chat/styles/main.cljs | 3 -- src/status_im/ui/screens/chat/views.cljs | 44 ++++++++----------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/status_im/ui/screens/chat/styles/main.cljs b/src/status_im/ui/screens/chat/styles/main.cljs index 13aa72ec77..368c9f76a4 100644 --- a/src/status_im/ui/screens/chat/styles/main.cljs +++ b/src/status_im/ui/screens/chat/styles/main.cljs @@ -1,9 +1,6 @@ (ns status-im.ui.screens.chat.styles.main (:require [status-im.ui.components.colors :as colors])) -(def scroll-root - {:flex 1}) - (def chat-view {:flex 1 :background-color colors/white}) diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index 347d979c1f..930a76ec84 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -438,32 +438,26 @@ ;; components (e.g. chat-toolbar) there can be a brief visual inconsistancy like showing 'add contact' ;; in public chat (when (= chat-id current-chat-id) - ;; this scroll-view is a hack that allows us to use on-blur and on-focus on Android - ;; more details here: https://github.com/facebook/react-native/issues/11071 - [react/scroll-view {:scroll-enabled false - :style style/scroll-root - :content-container-style style/scroll-root - :keyboard-should-persist-taps :handled} + [react/view {:style style/chat-view + :on-layout (fn [e] + (re-frame/dispatch [:set :layout-height (-> e .-nativeEvent .-layout .-height)]))} ^{:key current-chat-id} - [react/view {:style style/chat-view - :on-layout (fn [e] - (re-frame/dispatch [:set :layout-height (-> e .-nativeEvent .-layout .-height)]))} - [chat-toolbar current-chat public? modal?] - [connectivity/connectivity-view anim-translate-y] - [connectivity/connectivity-animation-wrapper - {} - anim-translate-y - [messages-view-animation - ;;TODO(kozieiev) : When FlatList in react-native-desktop become viable it should be used instead of optimized ScrollView for chat - (if platform/desktop? - [messages-view-desktop current-chat modal?] - [messages-view current-chat modal?])]] - (when show-input? - [input/container]) - (when show-stickers? - [stickers/stickers-view]) - (when show-message-options? - [message-options/view])]]))) + [chat-toolbar current-chat public? modal?] + [connectivity/connectivity-view anim-translate-y] + [connectivity/connectivity-animation-wrapper + {} + anim-translate-y + [messages-view-animation + ;;TODO(kozieiev) : When FlatList in react-native-desktop become viable it should be used instead of optimized ScrollView for chat + (if platform/desktop? + [messages-view-desktop current-chat modal?] + [messages-view current-chat modal?])]] + (when show-input? + [input/container]) + (when show-stickers? + [stickers/stickers-view]) + (when show-message-options? + [message-options/view])]))) (defview chat [] [chat-root false])