Skip to content

Commit

Permalink
RNMobile - Stepper - Rename props to match other components
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo Pacheco committed Jan 30, 2020
1 parent 01e70fb commit 1a011eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ class BottomSheetStepperCell extends Component {
}

onIncrementValue() {
const { step, maxValue, onChangeValue, value } = this.props;
const { step, max, onChange, value } = this.props;
const newValue = value + step;

if ( newValue <= maxValue ) {
onChangeValue( newValue );
if ( newValue <= max ) {
onChange( newValue );
this.announceValue( newValue );
}
}

onDecrementValue() {
const { step, minValue, onChangeValue, value } = this.props;
const { step, min, onChange, value } = this.props;
const newValue = value - step;

if ( newValue >= minValue ) {
onChangeValue( newValue );
if ( newValue >= min ) {
onChange( newValue );
this.announceValue( newValue );
}
}
Expand Down Expand Up @@ -102,9 +102,9 @@ class BottomSheetStepperCell extends Component {
}

render() {
const { label, icon, minValue, maxValue, value, separatorType } = this.props;
const isMinValue = value === minValue;
const isMaxValue = value === maxValue;
const { label, icon, min, max, value, separatorType } = this.props;
const isMinValue = value === min;
const isMaxValue = value === max;
const labelStyle = [ styles.cellLabel, ! icon ? styles.cellLabelNoIcon : {} ];

const accessibilityLabel = sprintf(
Expand Down
14 changes: 7 additions & 7 deletions packages/components/src/mobile/stepper-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Usage example
```jsx
import { StepperControl } from '@wordpress/components';

function Stepper( { onChangeValue, value } ) {
function Stepper( { onChange, value } ) {
return (
<StepperControl
icon="screenoptions"
label="Columns"
maxValue={ 8 }
minValue={ 1 }
onChangeValue={ onChangeValue }
max={ 8 }
min={ 1 }
onChange={ onChange }
value={ value }
/>
);
Expand All @@ -26,15 +26,15 @@ function Stepper( { onChangeValue, value } ) {

## Props

### maxValue
### max

Maximum value of the stepper.

- Type: `Number`
- Required: Yes
- Platform: Mobile

### minValue
### min

Minimum value of the stepper.

Expand All @@ -58,7 +58,7 @@ Current value of the stepper.
- Required: Yes
- Platform: Mobile

### onChangeValue
### onChange

Callback called when the value has changed

Expand Down
12 changes: 6 additions & 6 deletions packages/components/src/mobile/stepper-control/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import StepperCell from '../bottom-sheet/stepper-cell';
function StepperControl( {
icon,
label,
maxValue,
minValue,
onChangeValue,
max,
min,
onChange,
separatorType,
step,
value,
} ) {
return <StepperCell
icon={ icon }
label={ label }
maxValue={ maxValue }
minValue={ minValue }
onChangeValue={ onChangeValue }
max={ max }
min={ min }
onChange={ onChange }
separatorType={ separatorType }
step={ step }
value={ value }
Expand Down

0 comments on commit 1a011eb

Please sign in to comment.