Skip to content

Commit e5a8242

Browse files
committed
Created dragOutEnabled prop in BottomSheet
1 parent f2d2dd3 commit e5a8242

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

packages/react-native-eyecandy/src/components/ActionSheet/ActionSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Color from 'color';
77

88
import { ActionSheetAndroid } from '../../modules';
99
import { Body } from '../../typography';
10-
import BottomSheet from '../BottomSheet';
10+
import { BottomSheet } from '../BottomSheet';
1111
import Menu from '../Menu';
1212
import MenuItemBase from '../MenuItemBase';
1313

packages/react-native-eyecandy/src/components/BottomSheet/BottomSheet.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function ContentWrapper({
2424
testID,
2525
disableAnimations,
2626
setModalInvisible,
27+
dragOutEnabled,
2728
}: {
2829
children?: React.ReactNode;
2930
visible?: boolean;
@@ -35,6 +36,7 @@ function ContentWrapper({
3536
testID?: string;
3637
disableAnimations?: boolean;
3738
setModalInvisible: () => void;
39+
dragOutEnabled?: boolean;
3840
}) {
3941
return (
4042
<View
@@ -62,6 +64,7 @@ function ContentWrapper({
6264
visible={visible}
6365
onDismiss={onClose}
6466
onClose={setModalInvisible}
67+
dragOutEnabled={dragOutEnabled}
6568
>
6669
{children}
6770
</Content>
@@ -82,9 +85,10 @@ export interface BottomSheetProps {
8285
handleStyle?: StyleProp<ViewStyle>;
8386
testID?: string;
8487
disableAnimations?: boolean;
88+
dragOutEnabled?: boolean;
8589
}
8690

87-
function BottomSheet({
91+
export function BottomSheet({
8892
children,
8993
visible = false,
9094
height,
@@ -94,6 +98,7 @@ function BottomSheet({
9498
handleStyle,
9599
testID,
96100
disableAnimations,
101+
dragOutEnabled,
97102
}: BottomSheetProps) {
98103
const [modalVisible, setModalVisible] = useState<boolean | undefined>(
99104
visible,
@@ -126,6 +131,7 @@ function BottomSheet({
126131
testID={testID}
127132
disableAnimations={disableAnimations}
128133
setModalInvisible={setModalInvisible}
134+
dragOutEnabled={dragOutEnabled}
129135
>
130136
{children}
131137
</ContentWrapperWithHoc>
@@ -143,5 +149,3 @@ const styles = StyleSheet.create({
143149
flex: 1,
144150
},
145151
});
146-
147-
export default BottomSheet;

packages/react-native-eyecandy/src/components/BottomSheet/Content.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface ContentProps {
2828
handleStyle?: StyleProp<ViewStyle>;
2929
testID?: string;
3030
disableAnimations?: boolean;
31+
dragOutEnabled?: boolean;
3132
}
3233

3334
const clamp = (value: number, lowerBound: number, upperBound: number) => {
@@ -51,6 +52,7 @@ export default function Content({
5152
handleStyle,
5253
testID,
5354
disableAnimations,
55+
dragOutEnabled,
5456
}: ContentProps) {
5557
const { background, divider } = useColors(c => ({
5658
background: c.background.default,
@@ -59,7 +61,8 @@ export default function Content({
5961

6062
const fullHeight = 2 * height + handleHeight;
6163

62-
const topY = -height;
64+
// const topY = -height;
65+
const topY = dragOutEnabled ? -height : 0;
6366
const bottomY = height + handleHeight;
6467

6568
const y = useSharedValue(bottomY);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export { default } from './BottomSheet';
21
export * from './BottomSheet';

packages/react-native-eyecandy/src/components/SwipeConfirmation/SwipeConfirmation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from 'react-native';
88

99
import { Body } from '../../typography';
10-
import BottomSheet, { BottomSheetProps } from '../BottomSheet';
10+
import { BottomSheet, BottomSheetProps } from '../BottomSheet';
1111
import SwipeButton from '../SwipeButton';
1212

1313
export interface SwipeConfirmationProps extends BottomSheetProps {

packages/react-native-eyecandy/src/components/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ export {
7676
export { default as SwipeConfirmation } from './SwipeConfirmation';
7777
export type { SwipeConfirmationProps } from './SwipeConfirmation';
7878

79-
export { default as BottomSheet } from './BottomSheet';
80-
export type { BottomSheetProps } from './BottomSheet';
79+
export { BottomSheet, BottomSheetProps } from './BottomSheet';
8180

8281
// export { default as DatePicker } from './DatePicker';
8382
// export type { DatePickerProps } from './DatePicker';

0 commit comments

Comments
 (0)