Git Product home page Git Product logo

react-iscroll's Introduction

React iScroll

React component for wrapping iScroll library.

! Version 2.0 is only for React >= 15.5

! Breaking changes in version 1.0.0

  • Property for passing iScroll instance is renamed from iscroll to iScroll and naming is unified across whole package
    • use it like <ReactIScroll iScroll={iScroll}> instead of <ReactIScroll iscroll={iScroll}>
  • Inner content wrapper is removed. https://github.com/schovi/react-iscroll/commit/ecd75bb75667a45d2e14a2eda0a1b7d56c9d54f4
    • You can do it by yourself by wrapping childrens of ReactIScroll component into one more div with specific styling (check Horizontal scroll example there in README)
    • Main iScroll element has same behaviour and you can still change styling with style and className properties.

What is iScroll?

iScroll is a high performance, small footprint, dependency free, multi-platform javascript scroller.

-- iScroll's homepage

Works on mobile and desktop, supports zooming, pagging, parallax scrolling, carousels and is incredibly small (4kb compress gzipped).

Why React component?

React components are a great way to compose your application. And they are a great way to handle third party libraries. You can wrap complex logic around a library and expose a simple API, which react users are used to.

Install

npm install react-iscroll

Usage

Simple example app. Allow scrolling on long list and catch event when scrolling starts.

var React = require('react'),
    ReactIScroll = require('react-iscroll'),
    iScroll = require('iscroll');

var ExampleApp = React.createClass({
  getDefaultProps: function() {
    return ({
      options: {
        mouseWheel: true,
        scrollbars: true
      }
    })
  },
  onScrollStart: function() {
    console.log("iScroll starts scrolling")
  },
  render: function() {
    var i = 0, len = 1000, listOfLi = [];

    for(i; i < len; i++) {
      listOfLi.push(<li key={i}>Row {i+1}</li>)
    }

    return (
      <div style={height: '100vh'}>
        <h1>Example of scrollable list</h1>
        <ReactIScroll iScroll={iScroll}
                      options={this.props.options}
                      onScrollStart={this.onScrollStart}>
          <ul>
            {listOfLi}
          </ul>
        </ReactIScroll>
      </div>
    )
  }
})

FAQs

onScroll event does not works

You have to use probe version of iScroll and add probeType to <ReactIScroll options={{probeType:2}}>. Check iScroll documentation for more information.

Configuration (API)

Basic configuration. Just component with iScroll library. You can pick build which you want.

var iScroll = require('iscroll/build/iscroll-lite')

<ReactIScroll iScroll={iScroll}>
  <div>Long content...</div>
</ReactIScroll>

You can customize iScroll options with options property. Supports all from iScroll manual

var iScroll = require('iscroll/build/iscroll-probe')
var options = {
  mouseWheel: true,
  scrollbars: true,
  freeScroll: true,
  invertWheelDirection: true,
  momentum: false,
  indicators: {...}
}

<ReactIScroll iScroll={iScroll}
              options={options}>
  <div>Long content...</div>
</ReactIScroll>

Component supports all iScroll events. All of them passed iScroll instance to callback.

var iScroll = require('iscroll/build/iscroll-probe')

<ReactIScroll iScroll={iScroll}
              onBeforeScrollStart={this.onBeforeScrollStart}
              onScrollCancel={this.onScrollCancel}
              onScrollStart={this.onScrollStart}
              onScroll={this.onScroll}
              onScrollEnd={this.onScrollEnd}
              onFlick={this.onFlick}
              onZoomStart={this.onZoomStart}
              onZoomEnd={this.onZoomEnd}>
  <div>Long content...</div>
</ReactIScroll>

Plus there is one special event 'onRefresh' which is triggered when iScroll is refreshed. You can then get state of iScroll like iscroll.hasVerticalScroll, iscroll.x or iscroll.scale.

Watch out when updating state by value from iScroll. Always update state only when value changed to prevent circular updating (stack level too deep)

var iScroll = require('iscroll/build/iscroll-lite')

onRefresh: function(iScrollInstance) {
  var yScroll = iScrollInstance.y;

  console.log("vertical position:" + yScroll)

  if(this.state.y != yScroll) {
    this.setState({y: yScroll})
  }
},
render: function() {
  return (
    <ReactIScroll iScroll={iScroll}
                  onRefresh={this.onRefresh}>
      <div>Long content...</div>
    </ReactIScroll>
  )
}

function component.getIScroll()

Return iScroll instance if initialized

function component.withIScroll([waitForInit], callback)

Run callback with iScroll instance as argument if instance is initialized. You can pass true as first argument for call callback after iScroll is initialized

  onSomethingClick: function(ev) {
    ev.preventDefault()
    this.refs.iScroll.withIScroll(function(iScroll) {
      iScroll.scrollTo(0,0)
    })
  },

  render: function() {
    return(
      <div>
        <ReactIScroll ref="iScroll"
                      iScroll={iScroll}
                      onRefresh={this.onRefresh}>
          <div>Long content...</div>
          <a class="#" onClick={this.onSomethingClick}>Back to top</a>
        </ReactIScroll>
      </div>
    )
  }

Horizontal scroll

Common usecase of horizontal scrolling

var React = require('react'),
    ReactIScroll = require('react-iscroll'),
    iScroll = require('iscroll');

var HorizontalScroll = React.createClass({
  render: function() {
    return (
      <ReactIScroll iScroll={iScroll}
                    options={{mouseWheel: true, scrollbars: true, scrollX: true}}>
        <div style={{width:'200%'}}>
          <ul>
            {listOfLi}
          </ul>
        </div>
      </ReactIScroll>
    )
  }
})

Example

There is example application. You can run it with this commands:

  • npm install
  • npm run example
  • open http://localhost:8080/

To-Do

  • Add tests
  • Think about shouldComponentUpdate. Now it is always true because this.props.children are new object everytime and can't be compared via == or ===. Maybe there is some way how to cheaply compare them.
  • Don't initialize IScroll when there is no child supplied.

Done

  • Make this README.md :)
  • Trigger onRefresh event when iScroll is internally refreshed (e.g. on window resize)
  • Do not require('iscroll') by itself. Instead pass it in props (there is few different versions of iScroll and you want to pick correct one for you)
  • Publish to npm
  • Convert source code into Babel

License

React iScroll is released under the MIT License.

react-iscroll's People

Contributors

d-tucker avatar dstauffer avatar edi avatar jordancardwell avatar jshthornton avatar kmalakoff avatar litch avatar matt-schrader avatar mengel9 avatar omasback avatar schovi avatar syedirashid avatar toriaezunama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-iscroll's Issues

横向滚动问题

横向滚动在谷歌的手机模式下,无法正常滚动。请改进

Infinite scroll

It seems like only the initial fill is supported. The logic for dataFiller function is not wrapped into react-suitable way. So that as a user I could return a virtual dom.

onClick event donot work

onClick event donot work

<ReactIScroll iScroll={iscroll}>
                        <ul>
                            {this.props.data.trainListFilter.map((object, i) => {
                                return <li onClick={this.toDetail} key={i}>
                                    {object.train_code} <br/>
                                    出发站:{object.from_station_name} <br/>
                                    终点站: {object.to_station_name} <br/>
                                    出发时间:{object.start_time} <br/>
                                    到达时间:{object.arrive_time}<br/>
                                    历时: {object.run_time} <br/>
                                    {
                                        object.ticketinfo.map((ticketObject, i)=> {
                                            return <span
                                                key={i}>{ticketObject.ticket_name}{ticketObject.ticket_price}元</span>
                                        })
                                    }
                                    <hr/>
                                </li>
                            },this)}
                        </ul>
                    </ReactIScroll>

I must thank u for decouple~

import ReactIScroll from 'react-iscroll'
import iScroll from '../../utils/iscroll-cinema-zoom'

iscroll-cinema-zoom is my self-make,I just changed iscroll-zoom source code.

iScroll events onScroll not work

  <ReactIScroll iScroll={iScroll} options={{mouseWheel: true}} onScroll={function(){console.log(1)}} >
    <div>
      ...
    </div>
  </ReactIScroll>

the onScroll callback function not work,

ReactIScroll: options.zoom is set, but iscroll-zoom version is not required. Zoom feature won't work properly.

import React from 'react'
import ReactIScroll from 'react-iscroll'
import iScroll from 'iscroll'

export default class SeatMap extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      options: {
        zoom: true,
        mouseWheel: true,
        wheelAction: 'zoom',
        scrollbars: true,
        scrollX: true,
        scrollY: true
      }
    }
  }

  onZoomStart(){
    console.log('onZoomStart')
  }

  onZoomEnd(){
    console.log('onZoomEnd')
  }

  onScrollStart() {
    console.log("iScroll starts scrolling")
  }

  render(){
    var i = 0, len = 100, listOfLi = [];

    for(i; i < len; i++) {
      listOfLi.push(<li key={i}>Row {i+1}</li>)
    }

    return (
      <div style={{height: '300px'}}>
        <ReactIScroll iScroll={iScroll}
                      options={this.state.options}
                      onScrollStart={this.onScrollStart}
                      onZoomStart={this.onZoomStart}
                      onZoomEnd={this.onZoomEnd}
        >
          <ul>
            {listOfLi}
          </ul>
        </ReactIScroll>
      </div>
    )
  }
}

ReactIScroll: options.zoom is set, but iscroll-zoom version is not required. Zoom feature won't work properly.

I dont konw how to fix it ,please tell me ,thx!

Experiencing CSS/iScroll Load racing issue

I narrowed things down to something to do with chunk-injecting the css in webpack. If I use ExtractTextPlugin and all the css goes into a single file, everything works fine. But if I don't use that, and it blobs each css in, it does not work "on first load" ...works fine after that.

Additionally, if I put inline style on the parent item around the then that works too.

I'm curious why that makes a difference.... doesn't the CSS always load 100% before the JS does?

Can't scroll if I add the image tag into the scroll wrapper

Just like the title , when I type the code like this:

<ReactIScroll iScroll={iScroll}
                        options={iScrollOptions}
                        onRefresh={this._handleScrollRefresh}
                        onScrollStart={this._handleScrollStart}
                        probeType={2}
                        onScrollEnd={this._handleScrollEnd}>                        
  <div style={{width: "100%"}}>
    <ul>
      <li><img src="xxx" alt=""/></li>
      <li><img src="xxx" alt=""/></li>
      <li><img src="xxx" alt=""/></li>
    </ul>
  </div>
</ReactIScroll>

and then I can't scroll, could you tell me how to fixed it? thx

horizontal scroll: no autosize

scrollerStyle={{width: '200%'}} will give me a horizonal scrollbar (see issue #4). But how to auto-size the width? What if my content is wider/smaller than 200%?

the onScroll event doesn't fire though code 'var iScroll = require('iscroll/build/iscroll-probe')' is added

when I scroll the scroller, the alert doesn't fire,so wired. below is the code

import ReactIScroll from 'react-iscroll';
var iScroll = require('iscroll/build/iscroll-probe');
import React from 'react';
export default class TabelListView extends React.Component {
    onScroll(iScroll) {
        alert('t')
   }
   render(
      <ReactIScroll
                    ref="iScroll"
                    iScroll={iScroll}
                    onScroll={this.onScroll.bind(this)}>
      {...content}
    </ReactIScroll>
  )
}

Cannot set State or run another function in onScrollEnd event

Hi,

How to properly use the onScrollEnd event?
I successfully implement the onScrollEnd event, when it stop scrolling I print out something with console log and , the text shown. But when I try to run another function or setState one object. It's not working.

Please help. thanks.

1.1.3 causing 'npm ERR! cb() never called!'

We have "react-iscroll": "^1.1.0" in our package.json (allow minor version upgrades) and the new version (1.1.3) results in this error during npm install.

Using "react-iscroll": "1.1.2" instead.

dynamic content?

Hi,

i have tried this react iscroll, looks like it is no problem with the synchronization content, but failed when dynamic loads the contents.

plz advise if any method to solve this issue, thx.

0.1.6 and above fails to run

I have been having some problems with the later versions of react-iscroll.

I can get version 0.1.5 of react-iscroll to work, but anything later fails when I try to run the application.

React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of Page.
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of Page.

I have been looking through the code differences between 0.1.5 and 0.1.6 and notice quite a few changes surrounding webpack and Babel. So I can only assume that this is the cause? That is assuming I have been looking at the correct commits on GitHub compared with the release npm packages.

I am using React 0.14.5 with Gulp 3.9.0 & Babel if that helps at all.

Have you ever had this error? Am I missing some Babel plugins perhaps?

support indicators option?

can it be possiable to supoort options.indicators? I have noticed that this repo is not update for a long time. and I was really interested in this project, I am grateful that you can have a look about this.

Why no support for react 0.14.x

I was wonder why the react dependency is pinned down to > 0.13.0 and < 0.14.0 versions? I'm trying to use this package with Meteor which uses react 0.14.7.

Are there plans to update the package? are there any known issues if I were to fork it and require react v0.14.7 instead?

scrollTo with no easing

This is more of a question than an issue, as I'm sure this is possible, I would like to use scroll to with a straight line even scroll to the position, no easing. The closest I have gotten is

    let customEase = iScroll.utils.ease.quadratic
    customEase.style = "cubic-bezier(0, 0, 1, 1)"
    this.scrollRef[0].withIScroll((iScroll) => {
        iScroll.scrollTo(0, -max, seconds, customEase);
    })

But this still has easing. How do I get a true straight line scrollTo with even speed from A->B? What am I missing?

Thank you,

window is not defined

hello. I used this library.
I added code like tutorial.

<ReactIScroll
    iScroll={iScroll}
>
    {els}
</ReactIScroll>

but error messages are

 { ReferenceError: window is not defined
    at Object.<anonymous> (/Users/taeun/dev/workspace/git/shopping-web/node_modules/iscroll/build/iscroll-lite.js:994:4)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.iscroll/build/iscroll-lite (/Users/taeun/dev/workspace/git/shopping-web/packages/search/build/mobile/server/bundle.js:7203:18)
    at __webpack_require__ (/Users/taeun/dev/workspace/git/shopping-web/packages/search/build/mobile/server/bundle.js:26:30)
    at Module../src/mobile/components/Search/RelatedTag.tsx (

Why does it say there is no window object?

ease options with scrollToElement

I'm struggling applying a custom ease to scrollToElement, here is my relevant code bits. How would I apply a custom easing style or function to the scrollToElement?

var iScroll = require('iscroll/build/iscroll-probe')
  
      this.scrollRef[0].withIScroll((iScroll) => {
            iScroll.scrollToElement(this.refDict[ref], 500, 0, 0, false)
        })

                            <ReactIScroll ref={el => this.scrollRef[0] = el} iScroll={iScroll}
                                options={{
                                    scrollX: false,
                                    scrollY: true,
                                    probeType: 2,
                                    disableTouch: false,
                                    disablePointer: true,
                                    disableMouse: false,
                                    momentum: true,
                                    deceleration: 0.01,
                                    tap: true,
                                    mouseWheel: true,
                                    useTransition: true
                                }}
                                onScrollEnd={this.onScrollEnd}
                                onRefresh={this.initializeDonorRefs}
                            >

about scrollTo() ‘ question

import iScroll from 'iscroll/build/iscroll-probe';
import ReactIScroll from 'react-iscroll';

<ReactIScroll
    id="reactIScroll"
    ref="reactIScroll"
    iScroll={iScroll}
    onScrollEnd = {this.onScrollEnd.bind(this)}
    onScroll = {this.onScroll.bind(this)}
    options={{
        useTransition:true,
        mouseWheel: false,
        momentum: true,
        scrollbars: false,
        scrollY:true,
        scrollX:false,
        startY:scrollY
    }}>
    <div id="positionDom" className={ _Bottom ? 'hasBottom' : ''} ref="positionDom">
    {
        _list
    }
    </div>
</ReactIScroll>

gotoTopHandler(){
        var reactscroll = this.refs.reactIScroll;

        **_# PS: i want use  scrollTo() back Top like reactIScroll.scrollTo(0,0), can you tall me ,how can I do?_**

        console.log(reactscroll); 
        // reactscroll.props.iScroll.prototype.scrollTo(0,0,1000)
    }

    gotoTop (){
        return (<Tappable className="animated fadeInUp goto-top zindex-1000" component="button" onTap={this.gotoTopHandler.bind(this)}>
                    <div className="goto-top-inner">
                      <img src="../img/goto-top.png" alt=""/>
                    </div>
                </Tappable>)
    }

i want use scrollTo() back Top like reactIScroll.scrollTo(0,0), can you tall me ,how can I do?

iscroll-probe onScroll Event not work

onScroll event not work . and i bind the event correctly, except onScroll, other events work correctly

            <ReactIScroll iScroll={iScroll}
                  options={this.props.options}
                  onScrollStart={::this.onScrollStart}
                  onScrollCancel={::this.onScrollCancel}
                  onScrollStart={::this.onScrollStart}
                  onScroll={::this.onScroll}
                  onScrollEnd={::this.onScrollEnd}>

Can't get example working

ReferenceError: Unknown plugin "syntax-class-properties" specified in "/Users/cada/Downloads/react-iscroll-master/.babelrc" at 1, attempted to resolve relative to "/Users/cada/Downloads/react-iscroll-master"

can't Scroll horizontal

Even if I add freeScroll: true or scrollX: true to the options I can't get react-iscroll to scroll horizontal. Is there a special setting for it?

Can't get this working

I have a wrapper TileSorter CSS defined as:

  position: absolute;
  z-index: 1;
  top: 45px;
  bottom: 45px;
  left: 0;
  width: 1024px;
  background: #ccc;
  overflow: hidden;

and I have this as my view:

      <div className="TileSorter">
        <ReactIScroll
          iscroll={iScroll}
          options={iScrollOptions}
          onScrollStart={this._onScrollStart}
          scrollerStyle={{width: "200%"}}
        >
          {_.sortByOrder(tileArray, ['order'],['asc']).map((tile, i) => {
            return (
              <Tile key={tile.id}
                params= {this.props.params}
                index={i}
                id={tile.id}
                text={tile.text}
                isEditable = {isEditable}
                onMove={this.props.onMove}
                onDelete={this.props.onDelete}
              />
            );
          })}
          <TilePreview key="__preview" />
        </ReactIScroll>
      </div>

which looks like this...
View

I would expect it should horizontally scroll. however it does not. However the event onScrollStart seems to fire as expected.

Any ideas?

horizontal scroll fail

In this photogallary , I put 3 pics in it, and I use react-scroll in horizontal scroll. it works.
but when I put my finger on scroll area and scroll up and down , body`s scroll fail.
I was wondering if someone could help me. thanks!!

<ReactIScroll iScroll={iScroll}
       options={{scrollbars: false, scrollX: true, }}>
    <div style={{width:`${pics.length * 2.6}rem`}}>
       <ul>
            {
               pics.map((i,index) => {
                   return (
                        <Tappable
                             onTap={() => this.onTap(i,pics)}
                             key={index}
                             moveThreshold={10}
                           >
                            <img
                            src={`${i}/200`}
                            key={index}
                            style={{width:"2.4rem",height:"1.49rem",marginLeft:"0.1rem"}}
                             />
              </Tappable>
            )
          })
         }
   </ul>
  </div>
</ReactIScroll>

tim 20170702191713

react-dom not in package JSON

Is there a reason react-dom is not included in the package JSON? When I try to build my project react-dom is missing.

Update dependencies

First of all, you've done a good enough, thanks. but, as you know, react's version have upgraded to 15.0.1, can you spare a little time to upgrade the dependencies

Unable to find node on an unmounted component.

×

Unable to find node on an unmounted component.
▼ 5 stack frames were expanded.
invariant
node_modules/react-dom/cjs/react-dom.development.js:57
findCurrentFiberUsingSlowPath
node_modules/react-dom/cjs/react-dom.development.js:4439
findCurrentHostFiber
node_modules/react-dom/cjs/react-dom.development.js:4451
findHostInstance
node_modules/react-dom/cjs/react-dom.development.js:18563
findDOMNode
node_modules/react-dom/cjs/react-dom.development.js:19069
▲ 5 stack frames were expanded.
ReactIScroll._runInitializeIScroll
/home/USER_NAME/Desktop/PROJECTNAME/dist/PROJECT_FILE.min.js:74541
  74538 |     iScroll = _props.iScroll,
  74539 |     options = _props.options; // Create iScroll instance with given options
  74540 | 
**> 74541 | var iScrollInstance = new iScroll(_reactDom2.default.findDOMNode(this), options);**
        | ^  74542 | this._iScrollInstance = iScrollInstance; // TODO there should be new event 'onInitialize'
  74543 | 
  74544 | this._triggerRefreshEvent(); // Patch iScroll instance .refresh() function to trigger our onRefresh event
View compiled
(anonymous function)
/home/jhe76/Desktop/PROJECT/PROJECT_NAME/dist/PROJECT_FILE.min.js:74576
  74573 |   } else {
  74574 |     var timeout = defer === true ? 0 : defer;
  74575 |     this._initializeTimeout = setTimeout(function () {
> 74576 |       return _this4._runInitializeIScroll();
        | ^  74577 |     }, timeout);
  74578 |   }
  74579 | }
npm -v reactiscroll
6.4.1

I have to stick with this version because I don't have the rights to update package in my team.

Doesn't work if try to scroll by scroll thumb

Scrollbar is working fine using mouse wheel and touch scroll but if I try to scroll using scrollbar thumb it is not working. Please suggest if I am missing any property in options.

How to update options?

... after the react-iscroll was rendered on DOM? For example I want to disable scrollY under certain conditions and re-enable it later. Binding the options=... to a state variable didn't work...

While scrolling, if the mouse gets released outside of the frame the state remains pressed

I know this is more likely a browser issue but this is a nice improvment that could be acheived: could we reset the state or retest the mouse down states when mouse is out of the content?

you can reproduce on https://codepen.io/jakob-e/pen/wBmgYb by clicking the content to scroll and release mouse in the editor area since the preview is in a iframe

maybe somthing using code such as

document.body.addEventListener('mouseleave', function() {
  alert('left body we must recalculate on next mousemove if we still press the mouse button');
})

would help fixing this

COLLABORATOR WANTED

Actually, I don't need to use this or any similar library and my focus is totally somewhere else.
If there is anybody who actively uses this and would be able to handle issues and keep the bar with new React versions I would be glad to give him permissions :)
Or if anybody has better idea write it down there.

Not working on surface and large touch displays?

This has been, and does work great for me on all my mouse based testing, but testing on a microsoft surface touchscreen, and a large touchscreen display it only scrolls little bits, requiring lots of tiny choppy flicks to move at all, and generally is unacceptably buggy, am I missing something? I have also tried with var iScroll = require('iscroll/build/iscroll-probe') and the other versions.

import React, { Component } from 'react';
import ReactIScroll from 'react-iscroll';
import iScroll from 'iscroll';

class TestMin1 extends Component {

  random_text() {
    var text = "";
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    for (var i = 0; i < 10; i++)
      text += possible.charAt(Math.floor(Math.random() * possible.length));

    return (<div>{text}</div>)
  }

  render() {
    return (
      <div style={{ width: 800, height: 500, backgroundColor: 'blue' }}>

        <ReactIScroll iScroll={iScroll}
          options={{
            scrollX: false,
            scrollY: true,
            probeType: 2,
          }}
        >
          <div>
            {this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}{this.random_text()}
          </div>
        </ReactIScroll>
      </div>

    )
  }
}

export default TestMin1

"findDOMNode was called on an unmounted component"

The stack trace follows:

Invariant Violation: findDOMNode was called on an unmounted component.
  at message(~/react/lib/reactProdInvariant.js:32:0)
  at r(~/react/lib/findDOMNode.js:54:0)
  at this(~/react-iscroll/dist/react-iscroll.js:152:0)
  at _runInitializeIScroll(~/react-iscroll/dist/react-iscroll.js:184:0)
  at this(~/raven-js/src/raven.js:278:0)

I'm guessing that this has something to do with the fact that initialisation is done within a setTimeout. Do you think we could verify that the component is mounted before this happens?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.