11import React , { useState , useMemo , useRef } from 'react' ;
2- import { Animated , StyleSheet , LayoutChangeEvent , Dimensions } from 'react-native' ;
2+ import { Animated , StyleSheet , LayoutChangeEvent , Dimensions , ViewStyle } from 'react-native' ;
33import MaskLayer , { MaskLayerProps } from '../MaskLayer' ;
44
55let MainWidth = Dimensions . get ( 'window' ) . width ;
@@ -8,10 +8,11 @@ let MainHeight = Dimensions.get('window').height;
88export interface ModalProps extends MaskLayerProps {
99 placement ?: 'top' | 'right' | 'bottom' | 'left' ;
1010 onClosed ?: ( ) => void ;
11+ containerStyle ?: ViewStyle ;
1112}
1213
1314const Modal = ( props : ModalProps = { } ) => {
14- const { onClosed, visible, children, placement = 'bottom' , ...otherProps } = props ;
15+ const { onClosed, visible, children, placement = 'bottom' , containerStyle , ...otherProps } = props ;
1516 const AnimatedOpacity : Animated . Value = useRef ( new Animated . Value ( 0 ) ) . current ;
1617 // const [display] = useState<'none' | 'flex'>('none');
1718 let [ layoutHeight , setLayoutHeight ] = useState ( 0 ) ;
@@ -89,7 +90,9 @@ const Modal = (props: ModalProps = {}) => {
8990 translateStyle . translateX = translateValue ;
9091 }
9192 const child = (
92- < Animated . View style = { [ styles . content , placement && styles [ placement ] , { opacity : AnimatedOpacity } ] } >
93+ < Animated . View
94+ style = { [ styles . content , placement && styles [ placement ] , { opacity : AnimatedOpacity } , containerStyle ] }
95+ >
9396 < Animated . View
9497 onLayout = { measureContainer }
9598 style = { [
0 commit comments