From ff5076c5866be0f320fe7d3b603a30b7ee47c1c4 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 6 Aug 2023 20:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=B9=E7=AA=97=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Modal.tsx | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/components/common/Modal.tsx b/src/components/common/Modal.tsx index a2df19f2..59b27429 100644 --- a/src/components/common/Modal.tsx +++ b/src/components/common/Modal.tsx @@ -1,6 +1,6 @@ // import { createStyle } from '@/utils/tools' -import React, { useImperativeHandle, forwardRef, useState, useMemo, useCallback } from 'react' -import { type LayoutChangeEvent, Modal, TouchableWithoutFeedback, View, type ModalProps as _ModalProps, StyleSheet } from 'react-native' +import React, { useImperativeHandle, forwardRef, useState, useMemo } from 'react' +import { Modal, TouchableWithoutFeedback, View, type ModalProps as _ModalProps } from 'react-native' import StatusBar from './StatusBar' // import { useDimensions } from '@/utils/hooks' @@ -54,7 +54,6 @@ export default forwardRef(({ ...props }: ModalProps, ref) => { const [visible, setVisible] = useState(false) - const [height, setHeight] = useState(0) // const { window: windowSize } = useDimensions() const handleRequestClose = () => { if (keyHide) { @@ -69,11 +68,6 @@ export default forwardRef(({ } } - const handleLayout = useCallback((e: LayoutChangeEvent) => { - // console.log('e.nativeEvent.layout.height', e.nativeEvent.layout.height) - setHeight(e.nativeEvent.layout.height + StatusBar.currentHeight) - }, []) - useImperativeHandle(ref, () => ({ setVisible(_visible) { if (visible == _visible) return @@ -95,18 +89,12 @@ export default forwardRef(({ {...props} > {/* */} - {/* */} - { - height == 0 ? null - : ( - - - {memoChildren} - - - ) - } + + + {memoChildren} + + {/* */} )