From dbcb4422888c67e9b239978ce1eb40f24fdf344c Mon Sep 17 00:00:00 2001 From: Rayane Djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Fri, 17 May 2024 22:15:03 +0100 Subject: [PATCH] add chatContentScrollViewPlatformStyles --- src/pages/home/report/ReportActionsList.tsx | 9 ++------- src/styles/index.ts | 2 ++ .../chatContentScrollViewPlatformStyles/index.native.ts | 5 +++++ .../utils/chatContentScrollViewPlatformStyles/index.ts | 7 +++++++ .../utils/chatContentScrollViewPlatformStyles/types.ts | 5 +++++ 5 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src/styles/utils/chatContentScrollViewPlatformStyles/index.native.ts create mode 100644 src/styles/utils/chatContentScrollViewPlatformStyles/index.ts create mode 100644 src/styles/utils/chatContentScrollViewPlatformStyles/types.ts diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 70a35c12ba2f..d8aed24e3b13 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -18,7 +18,6 @@ import useReportScrollManager from '@hooks/useReportScrollManager'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import DateUtils from '@libs/DateUtils'; -import getPlatform from '@libs/getPlatform'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -600,12 +599,8 @@ function ReportActionsList({ const canShowHeader = !isOffline && !hasHeaderRendered.current && scrollingVerticalOffset.current > VERTICAL_OFFSET_THRESHOLD; const contentContainerStyle: StyleProp = useMemo( - () => [ - getPlatform() === CONST.PLATFORM.WEB || getPlatform() === CONST.PLATFORM.DESKTOP ? styles.overflowHidden : {}, - styles.chatContentScrollView, - isLoadingNewerReportActions && canShowHeader ? styles.chatContentScrollViewWithHeaderLoader : {}, - ], - [isLoadingNewerReportActions, styles.overflowHidden, styles.chatContentScrollView, styles.chatContentScrollViewWithHeaderLoader, canShowHeader], + () => [styles.chatContentScrollView, isLoadingNewerReportActions && canShowHeader ? styles.chatContentScrollViewWithHeaderLoader : {}], + [isLoadingNewerReportActions, styles.chatContentScrollView, styles.chatContentScrollViewWithHeaderLoader, canShowHeader], ); const lastReportAction: OnyxTypes.ReportAction | EmptyObject = useMemo(() => sortedReportActions.at(-1) ?? {}, [sortedReportActions]); diff --git a/src/styles/index.ts b/src/styles/index.ts index 7f64b59090f5..7947f03fece5 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -15,6 +15,7 @@ import colors from './theme/colors'; import type {ThemeColors} from './theme/types'; import addOutlineWidth from './utils/addOutlineWidth'; import borders from './utils/borders'; +import chatContentScrollViewPlatformStyles from './utils/chatContentScrollViewPlatformStyles'; import codeStyles from './utils/codeStyles'; import cursor from './utils/cursor'; import display from './utils/display'; @@ -1944,6 +1945,7 @@ const styles = (theme: ThemeColors) => flexGrow: 1, justifyContent: 'flex-start', paddingBottom: 16, + ...chatContentScrollViewPlatformStyles, }, // Chat Item diff --git a/src/styles/utils/chatContentScrollViewPlatformStyles/index.native.ts b/src/styles/utils/chatContentScrollViewPlatformStyles/index.native.ts new file mode 100644 index 000000000000..ee3f566ddc27 --- /dev/null +++ b/src/styles/utils/chatContentScrollViewPlatformStyles/index.native.ts @@ -0,0 +1,5 @@ +import type ChatContentScrollViewPlatformStyles from './types'; + +const chatContentScrollViewPlatformStyles: ChatContentScrollViewPlatformStyles = {}; + +export default chatContentScrollViewPlatformStyles; diff --git a/src/styles/utils/chatContentScrollViewPlatformStyles/index.ts b/src/styles/utils/chatContentScrollViewPlatformStyles/index.ts new file mode 100644 index 000000000000..cef1d5e70e6e --- /dev/null +++ b/src/styles/utils/chatContentScrollViewPlatformStyles/index.ts @@ -0,0 +1,7 @@ +import type ChatContentScrollViewPlatformStyles from './types'; + +const chatContentScrollViewPlatformStyles: ChatContentScrollViewPlatformStyles = { + overflow: 'hidden', +}; + +export default chatContentScrollViewPlatformStyles; diff --git a/src/styles/utils/chatContentScrollViewPlatformStyles/types.ts b/src/styles/utils/chatContentScrollViewPlatformStyles/types.ts new file mode 100644 index 000000000000..3fff2ba6a14d --- /dev/null +++ b/src/styles/utils/chatContentScrollViewPlatformStyles/types.ts @@ -0,0 +1,5 @@ +import type {ViewStyle} from 'react-native'; + +type ChatContentScrollViewPlatformStyles = ViewStyle; + +export default ChatContentScrollViewPlatformStyles;