Skip to content

Commit

Permalink
feat: add withOverlay props, made by @marcinolek
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Apr 14, 2020
1 parent fe267cd commit 5aa30f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions docs/PROPSMETHODS.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ Define if the handle on top of the modal is display or not.
| -------- | -------- | -------- |
| bool | No | `true` |

### `withOverlay`

Define if the overlay is display or not.

| Type | Required | Default |
| -------- | -------- | -------- |
| bool | No | `true` |

### `scrollViewProps`

An object to pass any of the react-native ScrollView's props.
Expand Down
6 changes: 4 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
closeOnOverlayTap: true,
withReactModal: false,
withHandle: true,
withOverlay: true,
openAnimationConfig: {
timing: { duration: 280, easing: Easing.ease },
spring: { speed: 14, bounciness: 4 },
Expand Down Expand Up @@ -825,9 +826,10 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
avoidKeyboardLikeIOS,
adjustToContentHeight,
modalElevation: elevation,
withOverlay,
} = this.props;
const { isVisible, lastSnap, showContent } = this.state;
const pointerEvents = alwaysOpen ? 'box-none' : 'auto';
const pointerEvents = alwaysOpen || !withOverlay ? 'box-none' : 'auto';

const keyboardAvoidingViewProps: Animated.AnimatedProps<KeyboardAvoidingViewProps> = {
keyboardVerticalOffset: keyboardAvoidingOffset,
Expand Down Expand Up @@ -862,7 +864,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
</AnimatedKeyboardAvoidingView>
)}

{this.renderOverlay()}
{withOverlay && this.renderOverlay()}
</View>
</TapGestureHandler>

Expand Down
6 changes: 6 additions & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ export interface IProps<FlatListItem = any, SectionListItem = any> {
*/
withHandle?: boolean;

/**
* Define if the overlay is display or not.
* @default true
*/
withOverlay?: boolean;

/*
* An object to pass any of the react-native ScrollView's props.
*/
Expand Down

0 comments on commit 5aa30f3

Please sign in to comment.