seatgeek / react-infinite

A browser-ready efficient scrolling container based on UITableView
Other
2.71k stars 273 forks source link

How to use it on a table in ruby on rails #250

Open Xindi-Li opened 6 years ago

Xindi-Li commented 6 years ago

I'm adding infinite scrolling to a table in an old project based on ruby on rails. I installed it using bower and imported it through //= require react-infinite in application.js because other js libraries were imported this way. var Infinite = require('react-infinite'); would raise an error "ReferenceError: require is not defined". Then I used it like this:

            <react-infinite containerHeight={200} elementHeight={40}>
          <ContentTable
            data={this.state.tableData}
            filterText={this.state.filterText}
            onUserClick={this.handleUserClick}
            dataType={this.props.dataType}
            showPublic={this.state.publicCheckbox}
          />
            </react-infinite>

But in the console, there is an error "Error: Cannot find module 'prop-types". How could I make it work?