Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/SwipeableView/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {PanResponder, View} from 'react-native';
import CONST from '@src/CONST';
import type SwipeableViewProps from './types';

function SwipeableView({children, onSwipeDown}: SwipeableViewProps) {
function SwipeableView({children, onSwipeDown, style}: SwipeableViewProps) {
const minimumPixelDistance = CONST.COMPOSER_MAX_HEIGHT;
const oldYRef = useRef(0);
const panResponder = useRef(
Expand All @@ -22,7 +22,14 @@ function SwipeableView({children, onSwipeDown}: SwipeableViewProps) {
}),
).current;

return <View {...panResponder.panHandlers}>{children}</View>;
return (
<View
style={style}
{...panResponder.panHandlers}
>
{children}
</View>
);
}

export default SwipeableView;
4 changes: 4 additions & 0 deletions src/components/SwipeableView/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import type {ReactNode} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';

type SwipeableViewProps = {
/** The content to be rendered within the SwipeableView */
children: ReactNode;

/** Callback to fire when the user swipes down on the child content */
onSwipeDown: () => void;

/** Additional styles applied to the wrapping view (native only) */
style?: StyleProp<ViewStyle>;
};

export default SwipeableViewProps;
12 changes: 9 additions & 3 deletions src/pages/inbox/report/ReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ function ReportFooter() {
return (
<View style={[chatFooterStyles, isComposerFullSize && styles.chatFooterFullCompose]}>
{shouldShowEnableNotificationsBanner && <EnableNotificationsBanner />}
<View style={shouldShowEnableNotificationsBanner ? composerOverlapStyle : undefined}>
<SwipeableView onSwipeDown={Keyboard.dismiss}>
<View style={[shouldShowEnableNotificationsBanner ? composerOverlapStyle : undefined, isComposerFullSize && styles.flex1]}>
<SwipeableView
onSwipeDown={Keyboard.dismiss}
style={isComposerFullSize ? styles.flex1 : undefined}
>
<ReportActionCompose reportID={reportIDFromRoute} />
</SwipeableView>
</View>
Expand Down Expand Up @@ -169,7 +172,10 @@ function ReportFooter() {
<View style={[styles.chatFooter, !isEditingWithComposer && styles.mt4, shouldUseNarrowLayout && styles.mb5]}>
{isEditingWithComposer && (
<View style={[isComposerFullSize ? styles.chatFooterFullCompose : undefined, styles.mb2]}>
<SwipeableView onSwipeDown={Keyboard.dismiss}>
<SwipeableView
onSwipeDown={Keyboard.dismiss}
style={isComposerFullSize ? styles.flex1 : undefined}
>
<ReportActionCompose.EditOnly reportID={reportIDFromRoute} />
</SwipeableView>
</View>
Expand Down
Loading