From 5e3b5199151d7469f3e657b2a97e19b9f13e8e97 Mon Sep 17 00:00:00 2001 From: hanyuxinting Date: Thu, 26 Sep 2024 11:33:05 +0800 Subject: [PATCH] fix: popup rn --- src/packages/popup/demo.taro.tsx | 9 +- src/packages/popup/demos/taro/demo1.tsx | 10 +- src/packages/popup/demos/taro/demo3.tsx | 19 ++-- src/packages/popup/popup.rn.tsx | 135 +++++++++--------------- 4 files changed, 74 insertions(+), 99 deletions(-) diff --git a/src/packages/popup/demo.taro.tsx b/src/packages/popup/demo.taro.tsx index 2086eab929..e220b48d2e 100644 --- a/src/packages/popup/demo.taro.tsx +++ b/src/packages/popup/demo.taro.tsx @@ -10,6 +10,7 @@ import Demo2 from './demos/taro/demo2' import Demo3 from './demos/taro/demo3' import Demo4 from './demos/taro/demo4' import Demo5 from './demos/taro/demo5' +import Demo7 from './demos/taro/demo7' import Demo8 from './demos/taro/demo8' const PopupDemo = () => { @@ -100,8 +101,12 @@ const PopupDemo = () => { {/* {translated.ea3d02f2} */} - {translated.c9e6df49} - {/* */} + {harmonyAndRn() ? null : ( + <> + {translated.c9e6df49} + + + )} {translated.cfbdc782} diff --git a/src/packages/popup/demos/taro/demo1.tsx b/src/packages/popup/demos/taro/demo1.tsx index 2c3822e34f..4b714a588c 100644 --- a/src/packages/popup/demos/taro/demo1.tsx +++ b/src/packages/popup/demos/taro/demo1.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { Popup, Cell } from '@nutui/nutui-react-taro' -import { View } from '@tarojs/components' +import { ScrollView, Text } from '@tarojs/components' const Demo1 = () => { const [showBasic, setShowBasic] = useState(false) @@ -19,15 +19,15 @@ const Demo1 = () => { setShowBasic(false) }} > - - {Array.from({ length: 20 }) + + {Array.from({ length: 1 }) .fill('') .map((_, i) => ( - 正文 + 正文 ))} - + ) diff --git a/src/packages/popup/demos/taro/demo3.tsx b/src/packages/popup/demos/taro/demo3.tsx index 87c018f6b0..38adca92ae 100644 --- a/src/packages/popup/demos/taro/demo3.tsx +++ b/src/packages/popup/demos/taro/demo3.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react' import { Popup, Cell } from '@nutui/nutui-react-taro' import { Heart } from '@nutui/icons-react-taro' +import { harmonyAndRn } from '@/utils/platform-taro' const Demo3 = () => { const [showIcon, setShowIcon] = useState(false) @@ -21,12 +22,18 @@ const Demo3 = () => { setShowIconPosition(true) }} /> - { - setShowIconDefine(true) - }} - /> + + {harmonyAndRn() ? null : ( + <> + { + setShowIconDefine(true) + }} + /> + + )} + { - !harmonyAndRn() && e.stopPropagation() + e.stopPropagation() if (closeOnOverlayClick) { const closed = onOverlayClick && onOverlayClick(e) closed && close() @@ -260,106 +261,68 @@ export const Popup: FunctionComponent< const renderPop = () => { return ( <> - {!harmonyAndRn() ? ( - - - {renderTitle()} - {showChildren ? children : ''} - - - ) : ( - <> - {innerVisible ? ( - - {renderTitle()} - {showChildren ? children : ''} - - ) : null} - - )} + {renderTitle()} + {showChildren ? children : ''} + + ) : null} ) } const renderPopByRN = () => { return ( - - - - - 这是一个从底部弹出的弹框!------ - - - 关闭 - - - - + {renderTitle()} + {showChildren ? children : ''} + ) } const renderNode = () => { return ( - <> - {/* {overlay ? ( - + {overlay ? ( + - ) : null} */} - {/* {renderPop()} */} + // visible={innerVisible} + // closeOnOverlayClick={closeOnOverlayClick} + // lockScroll={lockScroll} + // duration={duration} + onPress={onHandleClickOverlay} + > + + + ) : null} {renderPopByRN()} - + ) }