I have this application that i am writing in react-native, where i have this screen which displays around 50-100 images and some action buttons associated with them, including a pop-up menu(one associated with each of them). Is there a way that i can use same pop-up menu(same instance) for all images?
<View>
// react-native-paper Card Component
<Card style={styles.card}>
<Card.Content style={styles.cardContent}>
<Card.Cover
style={{ height: 60, width: 60 }}
source={
item.avatar ||
(item.gender === 'male'
? require('../../assets/male.jpeg')
: require('../../assets/female.jpeg'))
}
/>
<Caption style={styles.title}>{item.name}</Caption>
</Card.Content>
<Card.Actions>
<Avatar.Text
style={{ backgroundColor: 'skyblue' }}
size={24}
label={`#${item.id}`}
/>
// react-native-paper Menu Component
// can i somehow use a single component for all cards?
<Menu
visible={this.state.visible}
onDismiss={this._closeMenu}
anchor={
<IconButton
icon="menu"
theme={theme}
size={20}
onPress={() => console.log('Pressed')}
/>
}
>
<Menu.Item onPress={() => {}} title="Item 1" />
<Menu.Item onPress={() => {}} title="Item 2" />
<Divider />
<Menu.Item onPress={() => {}} title="Item 3" />
</Menu>
</Card.Actions>
</Card>
.
.
//same card multiple times
.
.
</View>