diff --git a/index.js b/index.js index 664ba4e..838e08a 100644 --- a/index.js +++ b/index.js @@ -56,6 +56,8 @@ export default class SwitchSelector extends Component { } getSwipeDirection(gestureState) { + const { disableGestures } = this.props; + if (disableGestures) return null; const { dx, dy, vx } = gestureState; // 0.1 velocity if (Math.abs(vx) > 0.1 && Math.abs(dy) < 80) { @@ -147,6 +149,7 @@ export default class SwitchSelector extends Component { accessibilityLabel, testID, touchableProps, + disableGestures, } = this.props; const { selected, sliderWidth } = this.state; @@ -300,6 +303,7 @@ SwitchSelector.defaultProps = { accessibilityLabel: null, testID: null, touchableProps: {}, + disableGestures: false, }; SwitchSelector.propTypes = { @@ -333,4 +337,5 @@ SwitchSelector.propTypes = { accessibilityLabel: PropTypes.string, testID: PropTypes.string, touchableProps: PropTypes.object, + disableGestures: PropTypes.bool, };