Modal组件可以用来覆盖包含React Native根视图的原生视图(如UIViewController,Activity)。
在嵌入React Native的混合应用中可以使用Modal。Modal可以使你应用中RN编写的那部分内容覆盖在原生视图上显示。
属性
animatedbool
已过期
请使用animationType
属性代替。
animationTypePropTypes.oneOf(['none', 'slide', 'fade'])
TheanimationType
prop controls how the modal animates.
slide
slides in from the bottomfade
fades into viewnone
appears without an animation
onRequestClosePlatform.OS === 'android' ? PropTypes.func.isRequired : PropTypes.func
TheonRequestClose
prop allows passing a function that will be called once the modal has been dismissed.
On the Android platform, this is a required function.
onShowfunction
TheonShow
prop allows passing a function that will be called once the modal has been shown.
transparentbool
Thetransparent
prop determines whether your modal will fill the entire view. Setting this totrue
will render the modal over a transparent background.
visiblebool
Thevisible
prop determines whether your modal is visible.
iosonOrientationChangePropTypes.func
TheonOrientationChange
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.
iossupportedOrientationsPropTypes.arrayOf(PropTypes.oneOf(['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']))
ThesupportedOrientations
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.