Skip to content

Commit 5371e72

Browse files
committed
restore Composer.ImportedState as compound subcomponent
1 parent 7d6e999 commit 5371e72

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
import {View} from 'react-native';
3+
import ImportedStateIndicator from '@components/ImportedStateIndicator';
4+
import useResponsiveLayout from '@hooks/useResponsiveLayout';
5+
import useThemeStyles from '@hooks/useThemeStyles';
6+
7+
function ComposerImportedState() {
8+
const styles = useThemeStyles();
9+
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
10+
const {isSmallScreenWidth} = useResponsiveLayout();
11+
12+
if (isSmallScreenWidth) {
13+
return null;
14+
}
15+
16+
return (
17+
<View style={[styles.mln5, styles.mrn5]}>
18+
<ImportedStateIndicator />
19+
</View>
20+
);
21+
}
22+
23+
export default ComposerImportedState;

src/pages/inbox/report/ReportActionCompose/ReportActionCompose.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import {View} from 'react-native';
3-
import ImportedStateIndicator from '@components/ImportedStateIndicator';
43
import OfflineIndicator from '@components/OfflineIndicator';
54
import OfflineWithFeedback from '@components/OfflineWithFeedback';
65
import useOnyx from '@hooks/useOnyx';
@@ -16,6 +15,7 @@ import ComposerDropZone from './ComposerDropZone';
1615
import ComposerEmojiPicker from './ComposerEmojiPicker';
1716
import ComposerExceededLength from './ComposerExceededLength';
1817
import ComposerFooter from './ComposerFooter';
18+
import ComposerImportedState from './ComposerImportedState';
1919
import ComposerInput from './ComposerInput';
2020
import ComposerLocalTime from './ComposerLocalTime';
2121
import ComposerProvider from './ComposerProvider';
@@ -28,8 +28,7 @@ type ReportActionComposeProps = {
2828

2929
function ComposerInner({reportID}: ReportActionComposeProps) {
3030
const styles = useThemeStyles();
31-
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
32-
const {isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout();
31+
const {shouldUseNarrowLayout} = useResponsiveLayout();
3332
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
3433
const [isComposerFullSize = false] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${reportID}`);
3534
const {reportPendingAction: pendingAction} = getReportOfflinePendingActionAndErrors(report);
@@ -58,11 +57,7 @@ function ComposerInner({reportID}: ReportActionComposeProps) {
5857
<Composer.ExceededLength />
5958
</Composer.Footer>
6059
</OfflineWithFeedback>
61-
{!isSmallScreenWidth && (
62-
<View style={[styles.mln5, styles.mrn5]}>
63-
<ImportedStateIndicator />
64-
</View>
65-
)}
60+
<Composer.ImportedState />
6661
</View>
6762
</View>
6863
);
@@ -86,6 +81,7 @@ Composer.SendButton = ComposerSendButton;
8681
Composer.Footer = ComposerFooter;
8782
Composer.TypingIndicator = AgentZeroAwareTypingIndicator;
8883
Composer.ExceededLength = ComposerExceededLength;
84+
Composer.ImportedState = ComposerImportedState;
8985

9086
export default Composer;
9187
export type {SuggestionsRef, ComposerRef, ReportActionComposeProps};

0 commit comments

Comments
 (0)