Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds support for supportedOrientations #224

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/extras/docs/BottomSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ A `ref` object used to call `close` and `isVisible` functions on the bottomSheet
| ----------------------------------------------------------- |
| `{ close: () => Promise<void>; isVisible: () => boolean; }` |

### `supportedOrientations`

iOS only. An array of strings that specify the orientations supported by the bottom sheet. Type is defined by [React Native Modal](https://reactnative.dev/docs/modal#supportedorientations-ios)

| Type |
| ---------------------------------------------------------------------------------------- |
| `['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']` |

## Known issues

If the app crashes with the following error:
Expand Down
4 changes: 4 additions & 0 deletions packages/extras/src/components/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
KeyboardAvoidingView,
LayoutChangeEvent,
Modal,
ModalProps,
Platform,
Pressable,
ScrollViewProps,
Expand Down Expand Up @@ -61,6 +62,7 @@ export type BottomSheetProps = {
visible: boolean;
ref?: React.RefObject<BottomSheetActions>;
shouldHandleKeyboardEvents?: boolean;
supportedOrientations?: ModalProps['supportedOrientations'];
};

export type BottomSheetActions = {
Expand Down Expand Up @@ -102,6 +104,7 @@ export const BottomSheet = React.forwardRef<
topInset,
onBottomSheetHidden,
shouldHandleKeyboardEvents = true,
supportedOrientations,
},
ref,
) => {
Expand Down Expand Up @@ -272,6 +275,7 @@ export const BottomSheet = React.forwardRef<
visible={isModalVisible}
onRequestClose={() => onClose()}
ref={ref as any}
supportedOrientations={supportedOrientations}
testID={testID}>
<Wrapper>
{renderContent ? (
Expand Down
Loading