react-iscroll icon indicating copy to clipboard operation
react-iscroll copied to clipboard

Infinite scroll

Open kof opened this issue 9 years ago • 11 comments

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.

kof avatar Apr 18 '16 19:04 kof

@kof Thanks for noticing. I will think about how to transform that into react way

schovi avatar May 03 '16 10:05 schovi

that means react-iscroll not support infinite scroll yet?

geminiyellow avatar May 11 '16 05:05 geminiyellow

@geminiyellow Definitely not now. It works with raw html inside, which is not React way.

schovi avatar May 11 '16 07:05 schovi

Solution for now is to mix it with another library like https://github.com/alexcurtis/react-infscroll

schovi avatar May 12 '16 06:05 schovi

thank you @schovi . infinite scroll in redux is so hard.

geminiyellow avatar May 12 '16 06:05 geminiyellow

@geminiyellow I am working on solution. It will take some time, but there is first API for that. it combine auto loading and infinite scrolling (rendering really long list) https://github.com/schovi/react-iscroll/blob/feature/infinite/example/examples/infinite.jsx

  1. new option infinite for setting up auto loading behaviour https://github.com/schovi/react-iscroll/blob/feature/infinite/example/examples/infinite.jsx#L10
  2. new event onLoadMore which is triggered when you reach end of scroll https://github.com/schovi/react-iscroll/blob/feature/infinite/example/examples/infinite.jsx#L74
  3. new component IScrollList which handle rendering of list items. I guess it could be used for every usage and not only infinite scrolling. It can still contain lot of optimalization for rendering. https://github.com/schovi/react-iscroll/blob/feature/infinite/example/examples/infinite.jsx#L76

Any suggestions, improvements or more features?

schovi avatar May 15 '16 16:05 schovi

What about leave core IScroll component alone and whole this infinite/list functionality leave on this new component?

schovi avatar May 15 '16 19:05 schovi

hi @schovi , thanks for your great work.

leave core IScroll component alone

yes, please keep the IScroll interface same with the official, let it alone. you can describe your project like this, based on iscroll but more powerful. LOL.

Any suggestions

ok, i think {this.state.list} is duplicate with this two line.

how about change the interface like react-virtualized, High-Order Components, this way, you can do more things.

or more features?

of cause, pull to refresh , other side of the infinite.

geminiyellow avatar May 16 '16 02:05 geminiyellow

@geminiyellow

react-virtualized just wow, amazing project, but reeeealy complex. My ambitions are much lower :)

High-Order Components, this way, you can do more things.

Can you give me specific simple example what you mean?

schovi avatar May 16 '16 09:05 schovi

@schovi yes, it is reeeealy complex, 😆

Can you give me specific simple example what you mean?

uh... i means let IScrollList work as a wrapper, not inside, like:

<IScrollList className="infinite-list" // classic html attributes
  items={this.state.list}   // list of items
  render={this.renderItem}  // item renderer function
  cache={1000}              // how many items is kept in cache
  prerender={10}            /* how many items is rendered before and after current viewport */ >
  <IScroll iScroll={iScroll} options={iScrollOptions} />
</IScrollList>

or:

IScrollList = IScrollList(IScroll, infinieOptions)

image

geminiyellow avatar May 17 '16 05:05 geminiyellow

@schovi this infinte example is not working 😞

orlowang avatar Oct 26 '16 07:10 orlowang