Skip to content

Commit

Permalink
fix: containerProps attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasFridmansky authored and Lipo11 committed Aug 10, 2023
1 parent 0b61c4f commit a18da78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default YourComponent;
`animationDuration` | number | 300 | The duration of the modal's opening and closing animations, in milliseconds.
`closeSpaceVisibility` | number (0 - 1) | 0.6 | A number representing the opacity of empty space, that will close the modal if `closeOnEmptySpace` is enabled.
`topOffset` | number | 0 | Determines the amount of space that the swipeable content will be offset from the top edge of window.
`containerProps` | ViewProps | | Additional props to be applied to the container.
## Public Methods
Expand Down
3 changes: 2 additions & 1 deletion src/components/SwipeModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const SwipeModal = forwardRef<SwipeModalPublicMethods, SwipeModalProps>( ( {
footerComponent,
disableSwipe = false,
topOffset = 0,
containerProps,
...props
}, ref ) => {

Expand Down Expand Up @@ -190,7 +191,7 @@ const SwipeModal = forwardRef<SwipeModalPublicMethods, SwipeModalProps>( ( {
useEffect( () => onHeightChange(), [ maxHeight ] );

const modalChildren = (
<View onLayout={onLayout} style={[ style, maxHeight !== 'auto' && SwipeModalStyles.flex, { backgroundColor: bg } ]}>
<View onLayout={onLayout} {...containerProps} style={[ style, maxHeight !== 'auto' && SwipeModalStyles.flex, { backgroundColor: bg } ]}>
{showBar && (
<View style={SwipeModalStyles.barContainer}>
<View style={[ SwipeModalStyles.bar, { backgroundColor: barColor } ]} />
Expand Down
3 changes: 2 additions & 1 deletion src/core/dto/swipeModalDTO.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import { ViewStyle } from 'react-native';
import { ViewProps, ViewStyle } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import { SharedValue } from 'react-native-reanimated';
import { AnimatedModalProps } from './animatedModalDTO';
Expand All @@ -22,6 +22,7 @@ export interface SwipeModalProps extends AnimatedModalProps {
footerComponent?: ReactNode;
disableSwipe?: boolean;
topOffset?: number;
containerProps?: ViewProps;
}

export type SwipeModalPublicMethods = {
Expand Down

0 comments on commit a18da78

Please sign in to comment.