Skip to content

Commit becc4c3

Browse files
committed
Merge branch 'hooks-1.0.0' of github.com:teamplanes/react-native-modal-controller into hooks-1.0.0
2 parents 1ee9b84 + 1df3fcd commit becc4c3

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/modal-controller.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,24 @@ const ModalControllerProvider = (props: ModalControllerProviderProps) => {
199199
<Context.Provider value={modalConsumerProps}>
200200
{props.children}
201201

202-
<Modal transparent animationType="none" visible={modals.length > 0}>
202+
<Modal
203+
transparent
204+
animationType="none"
205+
visible={modals.length > 0}
206+
supportedOrientations={
207+
(topModal &&
208+
topModal.supportedOrientations &&
209+
!!topModal.supportedOrientations.length &&
210+
topModal.supportedOrientations) ||
211+
(props.supportedOrientations &&
212+
!!props.supportedOrientations.length &&
213+
props.supportedOrientations) || [
214+
"portrait",
215+
"portrait-upside-down",
216+
"landscape"
217+
]
218+
}
219+
>
203220
<TouchableWithoutFeedback
204221
onPress={isCancelable ? hideTopModal : undefined}
205222
>

src/types.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/* eslint-disable import/no-unresolved */
22
import React from "react";
3-
import { StyleProp, ViewStyle, TextStyle, ImageStyle } from "react-native";
3+
import {
4+
StyleProp,
5+
ViewStyle,
6+
TextStyle,
7+
ImageStyle,
8+
ModalProps
9+
} from "react-native";
410
import { CustomAnimation, Animation } from "react-native-animatable";
511

612
export enum Priority {
@@ -31,6 +37,7 @@ export interface ModalType {
3137
absolutePositioning?: StyleProp<ViewStyle>;
3238
animation: AnimationConfig;
3339
params?: Record<string, any>;
40+
supportedOrientations?: ModalProps["supportedOrientations"];
3441
}
3542

3643
export interface ConsumerProps {
@@ -51,6 +58,7 @@ export interface ModalControllerProviderProps {
5158
[key: string]: CustomAnimation<TextStyle & ViewStyle & ImageStyle>;
5259
};
5360
children: React.ReactChild;
61+
supportedOrientations?: ModalProps["supportedOrientations"];
5462
}
5563

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

0 commit comments

Comments
 (0)