Skip to content

Commit ffd8319

Browse files
authored
Merge branch 'vnext' into dkamburov/update-ig-18.5.2-beta.1
2 parents 5d902ef + 6cd1924 commit ffd8319

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

samples/layouts/stepper/animations/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import {
55
IgrStepper, IgrStep, IgrStepperModule, IgrRadio, IgrRadioGroup, IgrRadioModule, IgrRadioGroupModule,
6-
IgrButton, IgrButtonModule, IgrInput, IgrInputModule, IgrSelect, IgrSelectItem, IgrSelectModule, IgrDropdown,
7-
IgrDropdownItemComponentEventArgs, IgrComponentValueChangedEventArgs, IgrSelectItemComponentEventArgs
6+
IgrButton, IgrButtonModule, IgrInput, IgrInputModule, IgrSelect, IgrSelectItem, IgrSelectModule,
7+
IgrSelectItemComponentEventArgs, IgrComponentValueChangedEventArgs
88
} from 'igniteui-react';
99
import 'igniteui-webcomponents/themes/light/bootstrap.css';
1010

samples/layouts/stepper/linear/src/index.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default class LinearStepper extends React.Component<any, any> {
1919
private stepperRef = React.createRef<IgrStepper>();
2020
private InfoForm = React.createRef<any>();
2121
private AddressForm = React.createRef<any>();
22+
private activeStepIndex = 0;
2223

2324
constructor(props: any) {
2425
super(props);
@@ -34,7 +35,7 @@ export default class LinearStepper extends React.Component<any, any> {
3435
public render(): JSX.Element {
3536
return (
3637
<div className="container sample">
37-
<IgrSwitch change={this.OnSwitchChange}></IgrSwitch>
38+
<IgrSwitch change={this.OnSwitchChange}><span key="liner-switch">Linear</span></IgrSwitch>
3839

3940
<IgrStepper ref={this.stepperRef} linear={this.state.linear} >
4041
<IgrStep key="info-step" invalid={this.state.linear && this.state.firstStepInvalid}>
@@ -89,24 +90,26 @@ export default class LinearStepper extends React.Component<any, any> {
8990
public OnSwitchChange(s: IgrCheckboxBase, e: IgrComponentBoolValueChangedEventArgs) {
9091
this.setState({ linear: s.checked });
9192
if(s.checked){
92-
this.checkAtiveStepValidity();
93+
this.checkActiveStepValidity();
9394
}
9495
}
9596

9697
public onInput(s: IgrInput, e: IgrComponentValueChangedEventArgs) {
9798
if(!this.state.linear) return;
9899

99-
this.checkAtiveStepValidity();
100+
this.checkActiveStepValidity();
100101
}
101102

102-
private checkAtiveStepValidity(){
103+
private checkActiveStepValidity(){
103104
const activeStep = this.activeStep;
104-
105-
const isInvalidForm = this.checkFormValidity(this.InfoForm);
106-
this.setState({firstStepInvalid: isInvalidForm});
107-
108-
const isInvalidForm2 = this.checkFormValidity(this.AddressForm);
109-
this.setState({ secondStepInvalid: isInvalidForm2 });
105+
if (activeStep && this.activeStepIndex === 0) {
106+
const isInvalidForm = this.checkFormValidity(this.InfoForm);
107+
this.setState({firstStepInvalid: isInvalidForm});
108+
}
109+
if (activeStep && this.activeStepIndex === 1) {
110+
const isInvalidForm = this.checkFormValidity(this.AddressForm);
111+
this.setState({ secondStepInvalid: isInvalidForm });
112+
}
110113
}
111114

112115
private checkFormValidity(form: any){
@@ -126,7 +129,10 @@ export default class LinearStepper extends React.Component<any, any> {
126129
}
127130

128131
private get activeStep(): IgrStep | undefined {
129-
return this.stepperRef.current.steps.find((step: IgrStep) => step.active);
132+
return this.stepperRef.current.steps.find((step: IgrStep, index: number) => {
133+
this.activeStepIndex = index;
134+
return step.active;
135+
});
130136
}
131137
}
132138

0 commit comments

Comments
 (0)