Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
react-native-gesture-helper
Advanced tools
A small library that adds returns gesture type when gestureState, the velocity threshold and the directional offset threshold is passed from the React Native pan responder.
npm install react-native-gesture-helper --save
Depending on the velocityThreshold and directionalOffsetThreshold the library will return wether or not the gestures is a swipe or a pan.
import React, {Component} from 'react';
import getGestureType from 'react-native-gesture-helper';
class SomeComponent extends Component {
componentWillMount: function() {
this._panResponder = PanResponder.create({
onPanResponderMove: (evt, gestureState) => {
// Add the gesture detection.
const velocityThreshold = 0.4;
const directionalOffsetThreshold = 80;
const swipeDirection = getGestureType(gestureState, velocityThreshold, directionalOffsetThreshold);
// Do what you will with the results here...
}
});
}
}
Param | Default | type | description |
---|---|---|---|
gestureState | null | Object | The gestureState value returned from the react Native PanResponder api |
velocityThreshold | 0.4 | Number | The Velocity threshold that decides wether the gesture is a swipe or a pan |
directionalOffsetThreshold | 80 | Number | The directional offset threshold of the gesture |
Based on the input the response returned fro the gesture should be one of the following.
npm test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
Feel free to contact me in twitter or create an issue
FAQs
A gesture helper for React Native
We found that react-native-gesture-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.