xcarpentier / rn-tourguide

🚩Make an interactive step by step tour guide for your react-native app (a rewrite of react-native-copilot)
https://xcarpentier.github.io/rn-tourguide/
Other
725 stars 213 forks source link

how can i use this for one item in a flatlist? #60

Open AnasAlamin opened 3 years ago

AnasAlamin commented 3 years ago

i have a flatlist and i want to wrap only one the first item in it. how can i do that?

yukari1414 commented 3 years ago

use conditionals in the FlatList renderItem property example:

<FlatList
  // ...
  renderItem={({ item }) => {
    const listItem = <Text>{item.content}</Text>;

    if (item.type === "render_tourguide") {
      return <TourGuideZone /* ... */>{listItem}</TourGuideZone>;
    }

    return listItem;
  }}
/>
julekgwa commented 2 years ago

The render Item function provides an index, check if index === 0 then wrap the item.

mbpictures commented 5 months ago

I'm using something like this:

<TourGuideZone isTourGuide={info.index === 0} /* ... */>{...}</TourGuideZone>

However the position of the zone is a bit off