@@ -9,7 +9,7 @@ import { StyledProps } from '../common';
99import useDefault from '../_util/useDefault' ;
1010import type { TdPullDownRefreshProps } from './type' ;
1111import { pullDownRefreshDefaultProps } from './defaultProps' ;
12-
12+ import { useLocaleReceiver } from '../locale/LocalReceiver' ;
1313import { usePrefixClass } from '../hooks/useClass' ;
1414import useDefaultProps from '../hooks/useDefaultProps' ;
1515import { convertUnit , reconvertUnit } from '../_util/convertUnit' ;
@@ -48,6 +48,7 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
4848 className,
4949 style,
5050 children,
51+ disabled,
5152 loadingTexts,
5253 loadingProps,
5354 loadingBarHeight,
@@ -65,6 +66,8 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
6566 const [ value , onChange ] = useDefault ( propsValue , defaultValue , propsOnChange ) ;
6667
6768 const name = usePrefixClass ( 'pull-down-refresh' ) ;
69+ const [ locale , t ] = useLocaleReceiver ( 'pullDownRefresh' ) ;
70+
6871 const touch = useTouch ( ) ;
6972 const loadingHeight = convertUnit ( loadingBarHeight ) ;
7073 const pureLoadingHeight = reconvertUnit ( loadingBarHeight ) ;
@@ -112,6 +115,7 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
112115 } , [ run ] ) ;
113116
114117 const doRefresh = async ( ) => {
118+ if ( disabled ) return ;
115119 setStatus ( PullStatusEnum . loading ) ;
116120 setDistance ( pureLoadingHeight ) ;
117121 try {
@@ -138,7 +142,7 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
138142 }
139143 } ;
140144
141- const statusText = getStatusText ( status , loadingTexts ) ;
145+ const statusText = getStatusText ( status , loadingTexts . length ? loadingTexts : t ( locale . loadingTexts ) ) ;
142146 let statusNode : ReactNode = < div className = { `${ name } __text` } > { statusText } </ div > ;
143147 if ( status === PullStatusEnum . loading ) {
144148 statusNode = < Loading text = { statusText } size = "24px" { ...loadingProps } /> ;
@@ -151,7 +155,7 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
151155
152156 const onTouchStart = ( e : React . TouchEvent ) => {
153157 e . stopPropagation ( ) ;
154- if ( ! isReachTop ( e ) || loading ) return ;
158+ if ( ! isReachTop ( e ) || loading || disabled ) return ;
155159
156160 setDistance ( 0 ) ;
157161 touch . start ( e ) ;
@@ -160,7 +164,7 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
160164
161165 const onTouchMove = ( e : React . TouchEvent ) => {
162166 e . stopPropagation ( ) ;
163- if ( ! isReachTop ( e ) || loading ) return ;
167+ if ( ! isReachTop ( e ) || loading || disabled ) return ;
164168 touch . move ( e ) ;
165169
166170 const { diffY, diffX } = touch ;
@@ -190,7 +194,7 @@ const PullDownRefresh: React.FC<PullDownRefreshProps> = (originProps) => {
190194
191195 const onTouchEnd = ( e : React . TouchEvent ) => {
192196 e . stopPropagation ( ) ;
193- if ( ! isReachTop ( e ) || loading ) return ;
197+ if ( ! isReachTop ( e ) || loading || disabled ) return ;
194198
195199 if ( status === PullStatusEnum . loosing ) {
196200 doRefresh ( ) ;
0 commit comments