-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ListView append new data onLoadMore #100
Comments
Hey @vnshgrg , could share your code with us? However, |
@SoHotSoup Here's my code:
So, with this i am able to fetch array of data from the server using _getFeed method, populate my ListView with the data. i am also able to fetch for new data and append it to the state but the appended array of data is not rendered in the ListView. The shoutem/ui documentation have very less information so couldn't figure it out. |
It's hard to get it from this code snippet but seems to me that <ListView
data={[].concat(this.props.state.feeds)}
onLoadMore = {this._updateFeed.bind(this)}
renderRow={this._renderRow.bind(this)}
/> |
Here's the reducer that handles data change. I am not sure if I am doing it correctly. case "APPEND_FEEDS": {
const prevState = state;
action.payload.map((feed) => {
prevState.feeds.push(feed);
});
const newFeeds = prevState.feeds;
state = Object.assign({}, state, {feeds: newFeeds});
break;
} UPDATE: I used the Thank you for helping me out @SoHotSoup, I am loving shoutem/ui and will be around. |
Ok, I was right about your reducer, you are mutating feeds. Just change After it, you can remove my previous suggestion and Please close issue if you're satisfied with my answer. |
Thank you very much. Works as expected. |
I have a ListView which gets data from an array which is stored in state. when the user scrolls to the bottom of the list, onLoadMore fires up and it appends new data to the data array in state. This however does not renders appended array as Rows in my ListView. Am I missing something here?
The text was updated successfully, but these errors were encountered: