Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CollageCom/react-tap-event-plugin

Repository files navigation

Introduction

You've probably heard of iOS's dreaded 300ms tap delay. React's onClick attribute falls prey to it. Facebook's working on a solution in the form of TapEventPlugin, but it won't be made available until 1.0.

If you're reading this, you're probably working on a project that can't wait until they figure out how they want to publish it. This repo is for you.

When Facebook solves #436 and #1170, this repo will disappear.

Usage

var injectTapEventPlugin = require("react-tap-event-plugin");
injectTapEventPlugin();

Example

See demo project for a complete working example.

var React = require("react");
var ReactDOM = require("react-dom");
injectTapEventPlugin = require("react-tap-event-plugin");
injectTapEventPlugin();
var Main = React.createClass({
 render: function() {
 return (
 <a
 href="#"
 onTouchTap={this.handleTouchTap}
 onClick={this.handleClick}>
 Tap Me
 </a>
 );
 },
 handleClick: function(e) {
 console.log("click", e);
 },
 handleTouchTap: function(e) {
 console.log("touchTap", e);
 }
});
ReactDOM.render(<Main />, document.getElementById("container"));

Build standalone version

Use the demo project and it's README instructions to build a version of React with the tap event plugin included.

ADDED FOR COLLAGE.COM

Run browserify to bundle reacttap into a standalone react wrapper that can be required from requireJS and includes all of react. NOTE: this is a really ugly hack and should be done correctly at some point soon.

cd demo
npm install
browserify reacttap.js --standalone ReactTap > reacttap-bundle.js

About

Instant TapEvents for React

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-react

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.8%
  • HTML 2.2%

AltStyle によって変換されたページ (->オリジナル) /