forked from software-mansion/react-native-gesture-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add duration to long press event (software-mansion#1505)
Description Added duration property to the LongPressGestureHandler events. This change allows checking how long the entire event lasted. Test code ```js import React, { Component } from 'react'; import { StyleSheet, View } from 'react-native'; import { LongPressGestureHandler, LongPressGestureHandlerStateChangeEvent, } from 'react-native-gesture-handler'; export class PressBox extends Component { private onHandlerStateChange = ( event: LongPressGestureHandlerStateChangeEvent ) => { console.log(`Duration: ${event.nativeEvent.duration}`); }; render() { return ( <LongPressGestureHandler onHandlerStateChange={this.onHandlerStateChange} minDurationMs={600}> <View style={styles.box} /> </LongPressGestureHandler> ); } } export default class Example extends Component { render() { return ( <PressBox /> ); } } const styles = StyleSheet.create({ box: { width: 150, height: 150, alignSelf: 'center', backgroundColor: 'plum', margin: 10, zIndex: 200, }, }); ```
- Loading branch information
1 parent
b172a79
commit 777fab8
Showing
8 changed files
with
109 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters