File tree Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -28,22 +28,23 @@ export default (props: ModalProps = {}) => {
2828 setLayoutWidth ( width ) ;
2929 }
3030 }
31- function getTransformSize ( ) {
32- if ( placement === 'top' ) {
33- return - layoutHeight ;
34- }
35- if ( placement === 'bottom' ) {
36- return layoutHeight ;
37- }
38- if ( placement === 'left' ) {
39- return - layoutWidth ;
40- }
41- if ( placement === 'right' ) {
42- return layoutWidth ;
43- }
44- return 0 ;
45- }
31+
4632 useMemo ( ( ) => {
33+ function getTransformSize ( ) {
34+ if ( placement === 'top' ) {
35+ return - layoutHeight ;
36+ }
37+ if ( placement === 'bottom' ) {
38+ return layoutHeight ;
39+ }
40+ if ( placement === 'left' ) {
41+ return - layoutWidth ;
42+ }
43+ if ( placement === 'right' ) {
44+ return layoutWidth ;
45+ }
46+ return 0 ;
47+ }
4748 const result = getTransformSize ( ) ;
4849 if ( ! result ) return ;
4950 if ( visible ) {
@@ -73,7 +74,7 @@ export default (props: ModalProps = {}) => {
7374 ] ) . start ( ) ;
7475 }
7576 // eslint-disable-next-line react-hooks/exhaustive-deps
76- } , [ visible , getTransformSize ] ) ;
77+ } , [ visible , layoutHeight , layoutWidth ] ) ;
7778 const translateStyle = { } as {
7879 translateY : Animated . Value ;
7980 translateX : Animated . Value ;
You can’t perform that action at this time.
0 commit comments