From d0e457908620aec510116b5f16c7fae04b8b3731 Mon Sep 17 00:00:00 2001 From: Alex Skiba Date: Thu, 21 Jan 2021 16:43:38 -0600 Subject: [PATCH 1/4] Added Touchable Feedback prop --- README.md | 1 + index.js | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2bf2866..0b5a758 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ export default class App extends React.Component { | delay | number | 200 | Time for delay between taps | | singleTap | function | null | callback for single tap event | | doubleTap | function | null | callback for double tap event | +| Feedback | boolean | true | Feedback on Tap (Opacity) | | ## License diff --git a/index.js b/index.js index f5473e3..690dfaf 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ import React, { Component } from "react"; -import { TouchableOpacity } from "react-native"; +import { TouchableOpacity, TouchableWithoutFeedback } from "react-native"; export default class DoubleTap extends Component { constructor(props) { @@ -13,6 +13,8 @@ export default class DoubleTap extends Component { this.lastTime = new Date(); // a timer is used to run the single tap event this.timer = false; + //Display visual feedback on touch + this.feedback = props.feedback ? props.feedback : true } _onTap = () => { @@ -51,11 +53,19 @@ export default class DoubleTap extends Component { }; render() { - return ( - - {this.props.children} - - ); + if(this.feedback){ + return ( + + {this.props.children} + + ) + } else { + return ( + + {this.props.children} + + ) + } } componentWillUnmount() { From d81d6dc8ad27c059eebc529987f6e2887afd5ec1 Mon Sep 17 00:00:00 2001 From: Alex Skiba Date: Thu, 21 Jan 2021 16:47:43 -0600 Subject: [PATCH 2/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0b5a758..6d661d2 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ export default class App extends React.Component { console.log("double tap"); }} delay={200} + feedback={true} >