Reputation: 1
i have a flatlist like image bellow. The code is this. How to implement the pop menu in this case?
renderList = () => (
<FlatList
data={this.props.contracts.data}
keyExtractor={item => String(item.id)}
renderItem={({ item }) => <ListItem onPress={() => {}} listItem={item} />}
/>
);
Upvotes: 0
Views: 989
Reputation: 4683
There is nothing special about rendering popup menu inside of flat list. Simply put it into your ListItem
component.
Ad "in most cases you should not have more menu providers in your app (see API documentation). In other cases use skipinstacecheck prop" warning. Normally (like 98% of cases) you should not have multiple MenuProvider
s in your application. If you put it inside of ListItem
, it will be rendered multiple times. Just use one MenuProvider
on the top of your applications - see main README:
Wrap your application inside MenuProvider and then simply use Menu component where you need it.
And there are plenty of examples where you can look into, e.g. https://github.com/instea/react-native-popup-menu/blob/master/examples/InFlatListExample.js
Upvotes: 3