File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import type { HolderRef } from '@rc-component/input/lib/BaseInput';
2121import { BaseInputProps } from '@rc-component/input/lib/interface' ;
2222import { InputFocusOptions , triggerFocus } from '@rc-component/input/lib/utils/commonUtils' ;
2323import useFrame from './hooks/useFrame' ;
24+ import useMobile from '@rc-component/util/lib/hooks/useMobile' ;
2425
2526export type { ValueType } ;
2627
@@ -133,7 +134,7 @@ const InternalInputNumber = React.forwardRef(
133134 downHandler,
134135 keyboard,
135136 changeOnWheel = false ,
136- controls = true ,
137+ controls,
137138
138139 stringMode,
139140
@@ -176,6 +177,9 @@ const InternalInputNumber = React.forwardRef(
176177 }
177178 }
178179
180+ const isMobile = useMobile ( ) ;
181+ const mergedControls = controls ?? ! isMobile ;
182+
179183 // ====================== Parser & Formatter ======================
180184 /**
181185 * `precision` is used for formatter & onChange.
@@ -607,7 +611,7 @@ const InternalInputNumber = React.forwardRef(
607611 onCompositionEnd = { onCompositionEnd }
608612 onBeforeInput = { onBeforeInput }
609613 >
610- { controls && (
614+ { mergedControls && (
611615 < StepHandler
612616 prefixCls = { prefixCls }
613617 upNode = { upHandler }
Original file line number Diff line number Diff line change 11/* eslint-disable react/no-unknown-property */
22import * as React from 'react' ;
33import cls from 'classnames' ;
4- import useMobile from '@rc-component/util/lib/hooks/useMobile' ;
54import raf from '@rc-component/util/lib/raf' ;
65import SemanticContext from './SemanticContext' ;
76
@@ -71,11 +70,6 @@ export default function StepHandler({
7170 ) ;
7271
7372 // ======================= Render =======================
74- const isMobile = useMobile ( ) ;
75- if ( isMobile ) {
76- return null ;
77- }
78-
7973 const handlerClassName = `${ prefixCls } -handler` ;
8074
8175 const upClassName = cls ( handlerClassName , `${ handlerClassName } -up` , {
You can’t perform that action at this time.
0 commit comments