From edaf5b7ad89c3580aebd186c4d6885c64671949f Mon Sep 17 00:00:00 2001 From: liuzejia Date: Thu, 22 Aug 2024 15:52:52 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E4=B8=BAreact=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=BA=93=E4=BD=BF=E7=94=A8forwardRef=E5=8C=85=E4=B8=80?= =?UTF-8?q?=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/button/index.tsx | 9 ++++++--- .../src/components/icon/index.tsx | 9 +++++---- .../src/components/image/index.tsx | 8 ++++++-- .../src/components/input/index.tsx | 8 ++++++-- .../src/components/pull-down-refresh/index.tsx | 8 +++++++- .../src/components/scroll-view/index.tsx | 6 ++++-- .../src/components/swiper/index.tsx | 17 ++++++++++++----- .../src/components/text/index.tsx | 9 ++++++--- .../src/components/view/index.tsx | 7 ++++++- .../src/utils/{index.ts => index.tsx} | 11 +++++++++++ 10 files changed, 69 insertions(+), 23 deletions(-) rename packages/taro-components-react/src/utils/{index.ts => index.tsx} (78%) diff --git a/packages/taro-components-react/src/components/button/index.tsx b/packages/taro-components-react/src/components/button/index.tsx index 2d07c7d0da30..2f06a0d072a3 100644 --- a/packages/taro-components-react/src/components/button/index.tsx +++ b/packages/taro-components-react/src/components/button/index.tsx @@ -3,7 +3,7 @@ import './style/index.scss' import classNames from 'classnames' import React from 'react' -import { omit } from '../../utils' +import { createForwardRefComponent,omit } from '../../utils' interface IProps extends Omit, 'type'> { size?: string @@ -15,6 +15,7 @@ interface IProps extends Omit, 'ty loading?: boolean type?: string className?: string + forwardedRef?: React.MutableRefObject } interface IState { @@ -54,6 +55,7 @@ class Button extends React.Component { hoverStayTime = 70, loading = false, type, + forwardedRef, } = this.props const cls = classNames( className, @@ -96,8 +98,9 @@ class Button extends React.Component { return (