Reputation: 2674
I need to longpress to make my chat to archive.(i.e) like whatsapp we have long press and make the chat to pin in the top
How can I make the same using react-native?
Upvotes: 4
Views: 16437
Reputation: 5451
These long presses can be handled by passing a function to the onLongPress
props of any of the Touchable
components.
Delay in ms, from onPressIn
, before onLongPress
is called.
delayLongPress
<TouchableOpacity
style={[styles.modelView]}
onLongPress={() => {
console.log('Long Press')
}}
delayLongPress={3000}>
<Image
style={[styles.modelSelection]}
source={{ uri: 'image' }}
resizeMode='contain'/>
</TouchableOpacity>
Upvotes: 9