Skip to content

Commit 924572a

Browse files
Update README and default value for borderRadius
1 parent e2748ba commit 924572a

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ yarn add react-native-sheet
4141

4242
**TypeScript example**
4343

44+
Add your ref using a hook and the BottomSheet component with its content. The props reference table is below, and the API of the ref is also below.
45+
4446
```tsx
4547
import { BottomSheet } from 'react-native-sheet';
4648

@@ -85,6 +87,38 @@ export default function App() {
8587
}
8688
```
8789

90+
### Props
91+
92+
| Prop | Required | Description | Possible Values | Default |
93+
| ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | --------------------------------- |
94+
| `children` | Yes | The content to show inside the Bottom Sheet. | React Node | - |
95+
| `height` | Yes | The height of the bottom sheet once opened. | number | - |
96+
| `colorScheme` | No | Force the bottom sheet to be a specific colour scheme. 'auto' will use host OS colour scheme (eg light or dark) and automatically change when host OS scheme changes. | 'auto', 'light', 'dark' | 'auto' |
97+
| `backdropClosesSheet` | No | Whether tapping/clicking on the backdrop behind the bottom sheet will close it. | true/false | true |
98+
| `backdropBackgroundColor` | No | RGBA or Hex string value for the backdrop color. | RGBA/Hex string | '#25252599' |
99+
| `sheetBackgroundColor` | No | RGBA or Hex string value for the background color of the bottom sheet. | RGBA/Hex string | Dark: '#222222', Light: '#F3F3F3' |
100+
| `draggable` | No | Whether the bottom sheet is draggable. | true/false | true |
101+
| `showDragIcon` | No | Whether to show the drag icon handle. Only displayed if `draggable` is set to true as well. | true/false | true |
102+
| `dragIconColor` | No | RGBA or Hex string value for the color of the drag icon handle. | RGBA/Hex string | Dark: '#444444', Light: '#A3A3A3' |
103+
| `dragIconStyle` | No | Inline JS style override for drag icon handle. | Style object | undefined |
104+
| `contentContainerStyle` | No | Inline JS style override for content container style. | Style object | undefined |
105+
| `borderRadius` | No | How rounded the corners of the sheet should be. | number | 10 |
106+
| `openTime` | No | How long the opening animation should take. | number | 300 |
107+
| `closeTime` | No | How long the closing animation should take. | number | 300 |
108+
| `onOpenStart` | No | Called when the bottom sheet _begins_ to open. | Void function | undefined |
109+
| `onOpenFinish` | No | Called when the bottom sheet _finishes_ opening. | Void function | undefined |
110+
| `onCloseStart` | No | Called when the bottom sheet _begins_ to close. | Void function | undefined |
111+
| `onCloseFinish` | No | Called when the bottom sheet _finishes_ closing. | Void function | undefined |
112+
113+
### Ref functions
114+
115+
Used by calling the functions on the ref, eg `bottomSheet.current?.show()`.
116+
117+
| Function | Description |
118+
| --------- | ------------------------ |
119+
| `.show()` | Opens the bottom sheet. |
120+
| `.hide()` | Closes the bottom sheet. |
121+
88122
## Example app
89123

90124
See the example folder for an example app.

src/features/BottomSheet/BottomSheet.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const BottomSheet = memo(
4040
showDragIcon = true,
4141
dragIconColor,
4242
dragIconStyle,
43-
borderRadius,
43+
borderRadius = 10,
4444
contentContainerStyle,
4545
onOpenStart,
4646
onOpenFinish,
@@ -150,8 +150,8 @@ export const BottomSheet = memo(
150150
styles.container,
151151
{
152152
height: animatedHeight,
153-
borderTopRightRadius: borderRadius ?? 10,
154-
borderTopLeftRadius: borderRadius ?? 10,
153+
borderTopRightRadius: borderRadius,
154+
borderTopLeftRadius: borderRadius,
155155
backgroundColor: sheetBackgroundColor || isDarkMode ? '#222222' : '#F3F3F3'
156156
}
157157
]}

0 commit comments

Comments
 (0)