diff --git a/src/index.tsx b/src/index.tsx index b664208a..612d1eaf 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -395,14 +395,8 @@ const ModalizeBase = ( setDisableScroll(shorterHeight && disableScrollIfPossible); }; - const handleContentLayout = ({ nativeEvent }: LayoutChangeEvent): void => { - if (onLayout) { - onLayout(nativeEvent); - } - + const handleContentLayout = (width: number, height: number): void => { if (alwaysOpen && adjustToContentHeight) { - const { height } = nativeEvent.layout; - return setModalHeightValue(height); } @@ -411,7 +405,7 @@ const ModalizeBase = ( return; } - handleBaseLayout('content', nativeEvent.layout.height); + handleBaseLayout('content', height); }; const handleComponentLayout = ( @@ -744,7 +738,7 @@ const ModalizeBase = ( listener: onScrollBeginDrag, }), scrollEventThrottle, - onLayout: handleContentLayout, + onContentSizeChange: handleContentLayout, scrollEnabled, keyboardDismissMode, };