Skip to content

Commit c15ae69

Browse files
authored
Stepper new design (#1547)
* Stepper - new component design and API * types * export types * fix parameter * fix typings exports * fix imports * removing unused imports * fix imports
1 parent 57484f6 commit c15ae69

31 files changed

+328
-345
lines changed

demo/src/screens/componentScreens/StepperScreen.js

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React, {Component} from 'react';
2+
import {View, Text, Stepper} from 'react-native-ui-lib'; //eslint-disable-line
3+
4+
5+
export default class StepperScreen extends Component {
6+
state = {
7+
stepperValue: 1
8+
};
9+
10+
stepperProps = {
11+
minValue: 0,
12+
maxValue: 3,
13+
value: 1
14+
};
15+
16+
onValueChange = (value: number, _?: string) => {
17+
this.setState({stepperValue: value});
18+
};
19+
20+
render() {
21+
const {stepperValue} = this.state;
22+
23+
return (
24+
<View padding-page>
25+
<Text text40 marginB-20>Stepper</Text>
26+
27+
<View centerV>
28+
<View row spread centerV>
29+
<Text text70>Default</Text>
30+
<Stepper/>
31+
</View>
32+
33+
<View row spread centerV marginT-30>
34+
<Text text70>Disabled</Text>
35+
<Stepper disabled/>
36+
</View>
37+
38+
<View row spread marginT-30>
39+
<Text text70>Step (0.5)</Text>
40+
<Stepper step={0.5}/>
41+
</View>
42+
43+
<View row spread marginT-30>
44+
<Text text70>Small</Text>
45+
<Stepper small/>
46+
</View>
47+
48+
<View marginT-30>
49+
<View row spread centerV>
50+
<Text text70>Custom</Text>
51+
<Stepper
52+
onValueChange={this.onValueChange}
53+
maxValue={this.stepperProps.maxValue}
54+
minValue={this.stepperProps.minValue}
55+
value={stepperValue}
56+
testID={'Stepper1'}
57+
/>
58+
</View>
59+
<View padding-5>
60+
<Text text80M>Stepper value: {stepperValue}</Text>
61+
<Text marginT-3>Initial value: {this.stepperProps.value}</Text>
62+
<Text marginT-3>Min value: {this.stepperProps.minValue}</Text>
63+
<Text marginT-3>Max value: {this.stepperProps.maxValue}</Text>
64+
</View>
65+
</View>
66+
</View>
67+
</View>
68+
);
69+
}
70+
}

generatedTypes/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export {default as View, ViewProps} from './src/components/view';
3535
export {default as Text, TextProps} from './src/components/text';
3636
export {default as TouchableOpacity, TouchableOpacityProps} from './src/components/touchableOpacity';
3737
export {default as Button, ButtonSize, ButtonProps} from './src/components/button';
38+
export {default as Stepper, StepperProps} from './src/components/stepper';
3839
export {default as Checkbox, CheckboxProps} from './src/components/checkbox';
3940
export {default as Chip, ChipProps} from './src/components/chip';
4041
export {default as ColorPicker, ColorPickerProps} from './src/components/colorPicker';
@@ -92,7 +93,6 @@ export {
9293
MaskedInput,
9394
ProgressBar,
9495
ColorSliderGroup,
95-
Stepper,
9696
ChipsInput,
9797
SharedTransition,
9898
Toast,
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
interface Props {
3+
/**
4+
* Initial value of the Stepper.
5+
*/
6+
value?: number;
7+
/**
8+
* Minimum value.
9+
*/
10+
minValue?: number;
11+
/**
12+
* Maximum value.
13+
*/
14+
maxValue?: number;
15+
/**
16+
* The step to increase and decrease by (default is 1)
17+
*/
18+
step?: number;
19+
/**
20+
* On value change callback function
21+
*/
22+
onValueChange?: (value: number, testID?: string) => void;
23+
/**
24+
* disables interaction with the stepper
25+
*/
26+
disabled?: boolean;
27+
/**
28+
* Renders a small sized Stepper
29+
*/
30+
small?: boolean;
31+
/**
32+
* Component accessibility label
33+
*/
34+
accessibilityLabel?: string;
35+
/**
36+
* Test id for component
37+
*/
38+
testID?: string;
39+
}
40+
export declare type StepperProps = Props;
41+
declare const _default: React.ComponentClass<Props & {
42+
useCustomTheme?: boolean | undefined;
43+
}, any>;
44+
export default _default;

src/components/stepper/StepperButton.js

Lines changed: 0 additions & 35 deletions
This file was deleted.
585 Bytes
Loading
931 Bytes
Loading
1.21 KB
Loading
2.17 KB
Loading
3.08 KB
Loading
417 Bytes
Loading
685 Bytes
Loading
963 Bytes
Loading
1.54 KB
Loading
2.18 KB
Loading
576 Bytes
Loading
1.02 KB
Loading
1.29 KB
Loading
2.27 KB
Loading
3.22 KB
Loading
454 Bytes
Loading
746 Bytes
Loading
991 Bytes
Loading
1.64 KB
Loading
2.24 KB
Loading

src/components/stepper/index.js

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
 (0)