From f3d4bed2e621b28080d790bbc6fc86169831911b Mon Sep 17 00:00:00 2001 From: edencorbin Date: Fri, 28 Apr 2017 20:25:53 -0700 Subject: [PATCH 1/2] added tap / click elements example to readme --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 17ccfa6..f7d3e23 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,37 @@ var HorizontalScroll = React.createClass({ }) ``` +## Tap / Click Elements inside IScroll + +To override the native scrolling iScroll has to inhibit some default browser behaviors, such as mouse clicks. See [iScroll manual](http://iscrolljs.com/) options.click and options.tap. The following is an example of including a clickable element. + +```js +constructor(props) { + super(props); + this.refDict = {}; +} + +componentDidMount() { + this.refDict[0].addEventListener("tap", () => this.handleTap(this.refDict[0])); +} + +handleTap(e) { + console.log(e.id); +} + +render(){ + return( + +
+
this.refDict[0] = el}> + Click me in react-iscroll +
+
+
+ ) +} +``` + ## Example There is example application. You can run it with this commands: From 1169658d7aefaee4308de9b3be3c798e805c4d04 Mon Sep 17 00:00:00 2001 From: edencorbin Date: Fri, 5 May 2017 09:26:41 -0700 Subject: [PATCH 2/2] added options code to example --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7d3e23..3a377c2 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ To override the native scrolling iScroll has to inhibit some default browser beh ```js constructor(props) { super(props); - this.refDict = {}; + this.refDict = []; } componentDidMount() { @@ -230,7 +230,11 @@ handleTap(e) { render(){ return( - +
this.refDict[0] = el}> Click me in react-iscroll