colbymillerdev / react-native-progress-steps

A simple and fully customizable React Native component that implements a progress stepper UI.
MIT License
375 stars 147 forks source link

Dynamically create Progress Steps on the fly #81

Open fengshuifever opened 3 years ago

fengshuifever commented 3 years ago

Hi there, I've seen this question asked before in the Issues area but the solutions didn't seem to work for me. Code:

<ProgressSteps>
...earlier progressstep
{recipe.recipeInstructions.map(function(name, index){
                        return (
                            <ProgressStep>
                                <View>
                                    <Text>Test Method {name}</Text>
                                </View>
                            </ProgressStep>
                        )
                    })}
</ProgressSteps>

What I'm trying to do above is generate a ProgressStep for every recipe instruction that exists in that array. Unfortunately as soon as I try this, an error throws with undefined is not an object (evaluating '_this.props.children[i].props.label')

This seems to be coming from the ProgressSteps.js file at around line 38 (where the is calling this.getChildProps().

Is there a way or an update coming to the package where we'll be able to dynamically create new ProgressStep components on the fly? I'm not quite sure how to progress with this. (I've also tried wrapping the ProgressStep tags with a Fragment but to no avail)

RashVenkat6795 commented 3 years ago

Hi @fengshuifever Any solutions for this ?

haseeb-numu commented 3 years ago

@fengshuifever @RashVenkat6795 i had same issue couple of days ago. i think i have figured out solution, waiting for PR to get merged. #91