Skip to content

Commit 0b79391

Browse files
committed
refactor: remove inline render wrappers
1 parent a365d18 commit 0b79391

1 file changed

Lines changed: 24 additions & 13 deletions

File tree

src/pages/inbox/report/ReportFooter.tsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,13 @@ function ReportFooter() {
8989

9090
const chatFooterStyles = {...styles.chatFooter, minHeight: !isOffline ? CONST.CHAT_FOOTER_MIN_HEIGHT : 0};
9191

92-
const renderComposerSwipeable = (isEditOnly = false) => (
93-
<SwipeableView onSwipeDown={Keyboard.dismiss}>
94-
<ReportActionCompose
95-
reportID={reportIDFromRoute}
96-
isEditOnly={isEditOnly}
97-
/>
98-
</SwipeableView>
99-
);
100-
101-
const renderComposer = () => <View style={[chatFooterStyles, isComposerFullSize && styles.chatFooterFullCompose]}>{renderComposerSwipeable()}</View>;
102-
10392
// Happy path — user can compose
10493
if (!shouldHideComposer) {
105-
return renderComposer();
94+
return (
95+
<View style={[chatFooterStyles, isComposerFullSize && styles.chatFooterFullCompose]}>
96+
<ComposerSwipeable reportID={reportIDFromRoute} />
97+
</View>
98+
);
10699
}
107100

108101
// Archived room
@@ -167,7 +160,14 @@ function ReportFooter() {
167160

168161
return (
169162
<View style={[styles.chatFooter, !isEditingWithComposer && styles.mt4, shouldUseNarrowLayout && styles.mb5]}>
170-
{isEditingWithComposer && <View style={[isComposerFullSize ? styles.chatFooterFullCompose : undefined, styles.mb2]}>{renderComposerSwipeable(true)}</View>}
163+
{isEditingWithComposer && (
164+
<View style={[isComposerFullSize ? styles.chatFooterFullCompose : undefined, styles.mb2]}>
165+
<ComposerSwipeable
166+
reportID={reportIDFromRoute}
167+
isEditOnly
168+
/>
169+
</View>
170+
)}
171171
<Banner
172172
containerStyles={[styles.chatFooterBanner, isEditingWithComposer && styles.mt2]}
173173
text={translate('adminOnlyCanPost')}
@@ -210,4 +210,15 @@ function ReportFooter() {
210210
return null;
211211
}
212212

213+
function ComposerSwipeable({reportID, isEditOnly = false}: {reportID: string; isEditOnly?: boolean}) {
214+
return (
215+
<SwipeableView onSwipeDown={Keyboard.dismiss}>
216+
<ReportActionCompose
217+
reportID={reportID}
218+
isEditOnly={isEditOnly}
219+
/>
220+
</SwipeableView>
221+
);
222+
}
223+
213224
export default ReportFooter;

0 commit comments

Comments
 (0)