mohebifar / react-native-copilot

Step-by-step walkthrough tooltip for your react native app
MIT License
2.22k stars 406 forks source link

Can I use a CopilotStep inside a map Item #153

Open dekm opened 4 years ago

dekm commented 4 years ago

Current Behavior A clear and concise description of the behavior.

I have an item which is part of my next step that resides inside a map. What I need to do is highlight one of the first items to describe it's purpose. Does anyone have experience doing this? Input Code

`<View style={{ flex: 1 }}>
              {this.props.foods.map((item, i) => (

                <Accordion title={item.name} data={item} value={false} key={item.id} number={i} />
              ))}
            </View>`

Expected behavior/code

For my step 2 I need this to happen inside a mapped Component. For example inside item 1.

Environment

Additional context/Screenshots Below is a screenshot of the items list I need to be highlighted as step 2.

Screenshot_20191004_121155_host exp exponent

blazk0 commented 4 years ago

I have attempted to do this and stumbled with the same situation as well. The way i see it there are 3 solutions :- 1 - You can wrap the entire view wrapping the map items with CopilotView. 2- You can wrap the single map item but in this case it will wrap the last item in the array. 3- You can create a mock up screen exactly like this screen, but of cource its all static, So you can wrap any child element.

I went with solution no. 3 as that was what i needed in my use case.

ncoen97 commented 3 years ago

What I did to solve this problem was something like this: list.map((item, index) => item === 0 ? (<CopilotStep ... > <Component /> </CopilotStep>) : (<Component />))