Skip to content

Commit 32064cc

Browse files
committed
feat: add custom-background example
1 parent 43ecf88 commit 32064cc

File tree

10 files changed

+305
-220
lines changed

10 files changed

+305
-220
lines changed

app/examples.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ const MainScreen = () => {
2727
onOpen: () => {
2828
actionSheetRef.current?.show();
2929
},
30+
},
31+
{
32+
title: 'Custom Background',
33+
onOpen: () => {
34+
SheetManager.show('custom-background');
35+
},
3036
},
3137
{
3238
title: 'Hello',

app/examples/custom-background.tsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from 'react';
2+
import {Text, View} from 'react-native';
3+
import ActionSheet, {SheetManager} from 'react-native-actions-sheet';
4+
import LinearGradient from 'react-native-linear-gradient';
5+
6+
export function CustomBackground() {
7+
return (
8+
<ActionSheet
9+
CustomHeaderComponent={<></>}
10+
gestureEnabled
11+
containerStyle={{
12+
height: '40%',
13+
alignItems: 'center',
14+
justifyContent: 'center',
15+
backgroundColor: 'transparent',
16+
}}>
17+
<LinearGradient
18+
colors={['#4c669f', '#3b5998', '#192f6a']}
19+
style={{
20+
width: '100%',
21+
height: 400,
22+
borderTopLeftRadius: 10,
23+
borderTopRightRadius: 10,
24+
justifyContent: 'center',
25+
alignItems: 'center',
26+
}}>
27+
<View
28+
style={{
29+
width: 100,
30+
height: 6,
31+
backgroundColor: '#f0f0f0',
32+
borderRadius: 10,
33+
opacity: 0.3,
34+
position: 'absolute',
35+
top: 10,
36+
}}
37+
/>
38+
39+
<Text
40+
onPress={() => {
41+
SheetManager.show('hello_two');
42+
}}
43+
style={{
44+
color: 'white',
45+
fontSize: 30,
46+
}}>
47+
Hello!
48+
</Text>
49+
</LinearGradient>
50+
</ActionSheet>
51+
);
52+
}

app/sheets.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import RouterSheet from './examples/router';
2222
import ScrollViewSheet from './examples/scrollview';
2323
import ResizeSheet from './examples/scrollview-resize';
2424
import SnapMe from './examples/snap-me';
25+
import { CustomBackground } from './examples/custom-background';
2526

2627
/**
2728
* We extend some of the types here to give us great intellisense
@@ -64,6 +65,7 @@ declare module 'react-native-actions-sheet' {
6465
}>;
6566
'legend-list': SheetDefinition;
6667
'custom-scroll-handlers': SheetDefinition;
68+
"custom-background": SheetDefinition
6769
}
6870
}
6971

@@ -86,7 +88,8 @@ const sheets: SheetRegisterProps['sheets'] = {
8688
'floating-sheet': FloatingSheet,
8789
'legend-list': LegendListExample,
8890
'custom-scroll-handlers': CustomScrollHandlers,
89-
"hello_two": Hello_Two
91+
"hello_two": Hello_Two,
92+
"custom-background": CustomBackground
9093
};
9194

9295
export const AppSheets = () => {

docs/pages/guides/safearea.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ The first one is `useBottomSafeAreaPadding`. This prop uses the top padding as a
88
<ActionSheet useBottomSafeAreaPadding />
99
```
1010

11-
The second one is `drawUnderStatusBar`. This is useful for action sheets that cover full screen. In that case, the sheet will grow under the StatusBar by default. However you can set this to `false` if you don't want that default behavior.
11+
The second one is `drawUnderStatusBar`. This is useful for action sheets that cover full screen. In that case, the sheet will grow under the StatusBar.
1212

1313
```tsx
14-
<ActionSheet drawUnderStatusBar={false} />
14+
<ActionSheet drawUnderStatusBar={true} />
1515
```

docs/pages/reference/actionsheet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ Draw action sheet container under the status bar.
288288
| ------- | -------- |
289289
| boolean | no |
290290

291-
Default: `true`
291+
Default: `false`
292292

293293
## `overdrawEnabled`
294294

0 commit comments

Comments
 (0)