mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Allow <Modal /> to be presented in different orientations
Reviewed By: javache Differential Revision: D3760002 fbshipit-source-id: 01f5c246fb0fc041ec2d63b4ef80de858fb6fdf2
This commit is contained in:
committed by
Facebook Github Bot 3
parent
a13e1c4e2c
commit
de3457f31d
@@ -111,6 +111,18 @@ class Modal extends React.Component {
|
||||
PropTypes.bool,
|
||||
'Use the `animationType` prop instead.'
|
||||
),
|
||||
/**
|
||||
* The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
|
||||
* On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
|
||||
* @platform ios
|
||||
*/
|
||||
supportedOrientations: PropTypes.arrayOf(PropTypes.oneOf(['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right'])),
|
||||
/**
|
||||
* The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
|
||||
* The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
|
||||
* @platform ios
|
||||
*/
|
||||
onOrientationChange: PropTypes.func,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@@ -144,6 +156,8 @@ class Modal extends React.Component {
|
||||
onShow={this.props.onShow}
|
||||
style={styles.modal}
|
||||
onStartShouldSetResponder={this._shouldSetResponder}
|
||||
supportedOrientations={this.props.supportedOrientations}
|
||||
onOrientationChange={this.props.onOrientationChange}
|
||||
>
|
||||
<View style={[styles.container, containerStyles]}>
|
||||
{this.props.children}
|
||||
|
||||
Reference in New Issue
Block a user