Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show dynamically the steps #61

Open
hanaechahid opened this issue Jul 15, 2020 · 3 comments
Open

show dynamically the steps #61

hanaechahid opened this issue Jul 15, 2020 · 3 comments

Comments

@hanaechahid
Copy link

hello, I have quizz array and i want to show the steps depending on the length and content of the array.
So what I did is:

<ProgressSteps
       ref={ref => { this.progressSteps = ref }}
       activeStep={this.state.activeStep}>
       { this.state.quizz.map((quiz, i) => {
                return  (
                    <ProgressStep label={quiz.name}
                         nextBtnStyle={styles.nextBtn} nextBtnTextStyle={styles.btnText}
                         scrollViewProps={this.defaultScrollViewProps}>
                    // some other elements
                  </ProgressStep>
                )
         }
 </ProgressSteps>

but I get this error :

Unhandled JS Exception: Invariant Violation: Invariant Violation: React.cloneElement(...): The argument must be a React element, but you passed undefined.

can anyone help me?!

@hanaechahid
Copy link
Author

@colbymillerdev help please !!!

@r083rt
Copy link

r083rt commented Mar 18, 2021

Try wrap the ProgressStep in a Fragment and add quiz.name as the key.

<ProgressSteps
       ref={ref => { this.progressSteps = ref }}
       activeStep={this.state.activeStep}>
       { this.state.quizz.map((quiz, i) => {
                return  (
                   <Fragment key={quiz.name}>
                           <ProgressStep label={quiz.name}
                              nextBtnStyle={styles.nextBtn} nextBtnTextStyle={styles.btnText}
                              scrollViewProps={this.defaultScrollViewProps}>
                   
                            </ProgressStep>
                  </Fragment>
                )
         }
 </ProgressSteps>

@minahilfaysl
Copy link

@colbymillerdev hello, were you able to find a solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants