Skip to content
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
19 changes: 18 additions & 1 deletion src/modal-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,24 @@ const ModalControllerProvider = (props: ModalControllerProviderProps) => {
<Context.Provider value={modalConsumerProps}>
{props.children}

<Modal transparent animationType="none" visible={modals.length > 0}>
<Modal
transparent
animationType="none"
visible={modals.length > 0}
supportedOrientations={
(topModal &&
topModal.supportedOrientations &&
!!topModal.supportedOrientations.length &&
topModal.supportedOrientations) ||
(props.supportedOrientations &&
!!props.supportedOrientations.length &&
props.supportedOrientations) || [
"portrait",
"portrait-upside-down",
"landscape"
]
}
>
<TouchableWithoutFeedback
onPress={isCancelable ? hideTopModal : undefined}
>
Expand Down
10 changes: 9 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* eslint-disable import/no-unresolved */
import React from "react";
import { StyleProp, ViewStyle, TextStyle, ImageStyle } from "react-native";
import {
StyleProp,
ViewStyle,
TextStyle,
ImageStyle,
ModalProps
} from "react-native";
import { CustomAnimation, Animation } from "react-native-animatable";

export enum Priority {
Expand Down Expand Up @@ -31,6 +37,7 @@ export interface ModalType {
absolutePositioning?: StyleProp<ViewStyle>;
animation: AnimationConfig;
params?: Record<string, any>;
supportedOrientations?: ModalProps["supportedOrientations"];
}

export interface ConsumerProps {
Expand All @@ -51,6 +58,7 @@ export interface ModalControllerProviderProps {
[key: string]: CustomAnimation<TextStyle & ViewStyle & ImageStyle>;
};
children: React.ReactChild;
supportedOrientations?: ModalProps["supportedOrientations"];
}

export type ShowModalConfig = Partial<ModalType> & Pick<ModalType, "name">;
Expand Down