Permalink
Browse files

fix stepper foucus pop keyboard bug, ref #476 #474 #390 #338

  • Loading branch information...
warmhug committed Nov 3, 2016
1 parent ef5f14d commit 94f4e54ab6bb9800fc987cc57d806b5921b11c9d
Showing with 15 additions and 24 deletions.
  1. +11 −13 components/stepper/demo/basic.tsx
  2. +4 −11 components/stepper/index.web.tsx
@@ -12,19 +12,17 @@ export default class StepperExample extends React.Component<any, any> {
return (
<View style={{ marginTop: 20 }}>
<List>

<List.Item extra={<Stepper key="0" max={10} min={1} defaultValue={3} onChange={onChange} />}>
readOnly: true
</List.Item>
<List.Item extra={
<Stepper size="small" key="1" max={10} min={1} readOnly={false} defaultValue={1} onChange={onChange} />
}>
readOnly: false
</List.Item>
<List.Item extra={<Stepper key="2" disabled max={10} min={1} defaultValue={3} onChange={onChange} />}>
禁用
</List.Item>

<List.Item extra={<Stepper key="0" max={10} min={1} defaultValue={3} onChange={onChange} />}>
readOnly: true
</List.Item>
<List.Item extra={
<Stepper size="small" key="1" max={10} min={1} readOnly={false} defaultValue={1} onChange={onChange} />
}>
readOnly: false
</List.Item>
<List.Item extra={<Stepper key="2" disabled max={10} min={1} defaultValue={3} onChange={onChange} />}>
禁用
</List.Item>
</List>
</View>
);
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import objectAssign from 'object-assign';
import splitObject from '../_util/splitObject';
import RcInputNumber from 'rc-input-number';
import StepProps from './StepPropTypes';

@@ -10,28 +10,21 @@ export default class Stepper extends React.Component<StepProps, any> {
step: 1,
readOnly: false,
showNumber: false,
focusOnUpDown: false,
};

render() {
const { prefixCls, className, showNumber } = this.props;
const [{ className, showNumber }, restProps] = splitObject(this.props, ['className', 'showNumber']);
const stepperClass = classNames({
[className as string]: !!className,
['showNumber']: !!showNumber,
});

const restProps = objectAssign({}, this.props);
['className', 'prefixCls', 'showNumber'].forEach(prop => {
if (restProps.hasOwnProperty(prop)) {
delete restProps[prop];
}
});

return (
<RcInputNumber
{...restProps}
ref="inputNumber"
prefixCls={prefixCls}
className={stepperClass}
{...restProps}
/>
);
}

0 comments on commit 94f4e54

Please sign in to comment.