Skip to content
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

Flat list onEndReached automatically render all the information #16322

Closed
geniushwan5263 opened this issue Oct 11, 2017 · 1 comment
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@geniushwan5263
Copy link

geniushwan5263 commented Oct 11, 2017

Is this a bug report?

No

Have you read the Contributing Guidelines?

No

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.4.0
Yarn: 0.27.5
npm: 5.4.0
Watchman: 4.7.0
Xcode: Xcode 8.3.3 Build version 8E3004b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react-native: 0.48.1 => 0.48.1
react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Target Platform: iOS (10.3), android (23)

Hello! I am actually pretty new to react native and I stuck on flat list.

Actually I implemented flat list like this with react navigation (tabs).

when I enter the tab, onEndReached start automatically although I did not scroll to the bottom.

please give me some tips to solve this.

these are my codes:

flat list:

return (

{console.log(this.state.comment)}

<FlatList
data={this.state.comment}
onEndReachedThreshold={0}
onEndReached={this._onEndReached}
renderItem={({ item }) => (
<ListItem
title={ item.comment }
subtitle={'\n\n\n' + this._getDay(item)}
/>
)}
keyExtractor={item => item.id}
/>

_onEndReached function (adding information to change state):

_onEndReached = () => {
if (!this.onEndReachedCalledDuringMomentum) {
this.setState({
page: this.state.page + 1 },
() => {
store.networkManager.requestUserCommentR(this.cbComment, this.state.page);
}
);
}
}

thank you for all!

@hramos
Copy link
Contributor

hramos commented Oct 12, 2017

This issue looks like a question that would be best asked on StackOverflow.

StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

Will close this as this is really a question that should be asked on StackOverflow.

@hramos hramos closed this as completed Oct 12, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Oct 12, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants