Skip to content

Commit cb49e8d

Browse files
authored
Merge pull request #438 from nguyenthanhan/master
fix: add enableElevation prop to ActionSheet for shadow support
2 parents fdf14ac + 0761194 commit cb49e8d

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

docs/pages/reference/actionsheet.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@ Choose how far off the user needs to drag the action sheet to make it snap to ne
196196

197197
Default: `50`
198198

199+
## `enableElevation`
200+
201+
Enable elevation on the action sheet container.
202+
203+
| Type | Required |
204+
| --------- | -------- |
205+
| `boolean` | no |
206+
207+
Default: `true`
208+
199209
## `elevation`
200210

201211
Set elevation to the ActionSheet container.

src/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
7777
closeOnPressBack = true,
7878
springOffset = 50,
7979
elevation = 5,
80+
enableElevation = true,
8081
defaultOverlayOpacity = 0.3,
8182
overlayColor = 'black',
8283
closable = true,
@@ -1533,12 +1534,16 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
15331534
borderBottomLeftRadius:
15341535
containerStyle?.borderBottomLeftRadius || undefined,
15351536
borderBottomRightRadius:
1536-
containerStyle?.borderBottomRightRadius || undefined,
1537-
borderRadius: containerStyle?.borderRadius || undefined,
1538-
width: containerStyle?.width || '100%',
1539-
...getElevation(
1540-
typeof elevation === 'number' ? elevation : 5,
1541-
),
1537+
props.containerStyle?.borderBottomRightRadius ||
1538+
undefined,
1539+
borderRadius:
1540+
props.containerStyle?.borderRadius || undefined,
1541+
width: props.containerStyle?.width || '100%',
1542+
...(enableElevation
1543+
? getElevation(
1544+
typeof elevation === 'number' ? elevation : 5,
1545+
)
1546+
: {}),
15421547
flex: undefined,
15431548
height: dimensions.height,
15441549
maxHeight: dimensions.height,

src/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ export type ActionSheetProps<SheetId extends keyof Sheets = never> = {
156156
*/
157157
keyboardHandlerEnabled?: boolean;
158158

159+
/**
160+
* Enable elevation. This will add a shadow to the ActionSheet.
161+
*
162+
* Default: `true`
163+
*/
164+
enableElevation?: boolean;
165+
159166
/**
160167
* Add elevation to the ActionSheet container.
161168
*

0 commit comments

Comments
 (0)