Skip to content

Commit

Permalink
feat: add modalElevation for Android #161
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Mar 29, 2020
1 parent 269934e commit 0ad5923
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 11 additions & 3 deletions docs/PROPSMETHODS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ Define where the handle on top of the modal should be positioned.
| ------------------------- | -------- | --------- |
| enum('outside', 'inside') | No | `outside` |

### `modalElevation`

A number to define the elevation of the modal on Android. Useful if you have other elements of your app using other values of elevation.

| Type | Required | Platform |
| -------- | -------- | -------- |
| number | No | Android |

### `modalStyle`

Define the style of the modal.
Expand Down Expand Up @@ -192,9 +200,9 @@ Define if `Modalize` has to be wrap with the Modal component from react-native.

?> It's not recommended to pass it at `true`. Check the [examples' documentation](/EXAMPLES.md) to find the other ways to handle it.

| Type | Required | Default |
| -------- | -------- | -------- |
| bool | No | `false` |
| Type | Required | Default | Platform |
| -------- | -------- | -------- | -------- |
| bool | No | `false` | iOS |

### `withHandle`

Expand Down
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
panGestureEnabled,
avoidKeyboardLikeIOS,
adjustToContentHeight,
modalElevation: elevation,
} = this.props;
const { isVisible, lastSnap, showContent } = this.state;
const pointerEvents = alwaysOpen ? 'box-none' : 'auto';
Expand All @@ -815,7 +816,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
}

return (
<View style={s.modalize} pointerEvents={pointerEvents}>
<View style={[s.modalize, { elevation }]} pointerEvents={pointerEvents}>
<TapGestureHandler
ref={this.modal}
maxDurationMs={100000}
Expand Down
5 changes: 5 additions & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export interface IProps<FlatListItem = any, SectionListItem = any> {
*/
handlePosition: 'outside' | 'inside';

/**
* A number to define the elevation of the modal on Android. Useful if you have other elements of your app using other values of elevation. (Android specific)
*/
modalElevation?: number;

/**
* Define the style of the modal.
*/
Expand Down

0 comments on commit 0ad5923

Please sign in to comment.