@makakwastaken/react-native-double-tap
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@makakwastaken/react-native-double-tap

Credit

Forked from awshawka/react-native-double-tap

A wrapper component for React Native which supports both double and single tap. Works on both Android and iOS.

Installation

  • npm install --save @makakwastaken/react-native-double-tap

or

  • yarn add @makakwastaken/react-native-double-tap

Usage

Class

export default class App extends React.Component {
  render() {
    return (
      <View>
        <DoubleClick
          singleTap={() => {
            console.log('single tap')
          }}
          doubleTap={() => {
            console.log('double tap')
          }}
          delay={200}
        >
          <Button title="Single or Double Tap" />
        </DoubleClick>
      </View>
    )
  }
}

Functional

const App: React.FC = () => {
  return (
    <View>
      <DoubleClick
        singleTap={() => {
          console.log('single tap')
        }}
        doubleTap={() => {
          console.log('double tap')
        }}
        delay={200}
      >
        <Button title="Single or Double Tap" />
      </DoubleClick>
    </View>
  )
}

Props

Property Type Default Description
delay number 200 Time for delay between taps
singleTap function null callback for single tap event
doubleTap function null callback for double tap event

License

MIT

Package Sidebar

Install

npm i @makakwastaken/react-native-double-tap

Weekly Downloads

29

Version

1.0.3

License

MIT

Unpacked Size

19.7 kB

Total Files

11

Last publish

Collaborators

  • makakwastaken