-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
FlatList - onPress triggered after 3 to 5 seconds ?. #18135
Comments
Thanks for posting this! It looks like your issue may be missing some required information. Are all the fields required by the Issue Template filled out? This is a friendly reminder and you may safely ignore this message if you believe your issue contains all the relevant information. Thank you for your contributions. |
@manojcena are you able to produce a https://snack.expo.io/ or standalone project example? |
@joshyhargreaves sorry i cannot provide that. the over app functionality is to load the contacts in the device and display them in once screen and click on particular contact open chat screen. only these are the screens like a whats up all contacts and click on contact open chat screen. i have 600 contacts in my phone and when i installed the app and its loading the contacts from device and displayed using flat list and when i click on single contact it open chat screen and when i send message in chat screen the onPress event also triggering slowly. when i installed app in other device having less constants around 30 app is working perfectly in both contact list and chat list. |
I suspect the delay in the There are a number of params you can tweak: |
@joshyhargreaves |
I am afraid the only way to fix this is to set a fix height to all rows. I have tried. It works perfectly. https://facebook.github.io/react-native/docs/flatlist.html#getitemlayout AND Extract renderItem content to React.PureComponent, which I see you have done this already. |
Issue resolved by using maxToRenderPerBatch now it is working fine. thank you @joshyhargreaves maxToRenderPerBatch = {1} |
@manojcena I will give it a shot! |
Description
I am displaying user contacts by retrieving from the the user device and i used flat list to display them in the page. when click on particular contact the onPress event triggered after 3 to 5 seconds when the total contacts above 100 but when i statically put 50 contacts on list the onPress event triggered immediately.
Expected Behavior
trigger the on Press event when click on particular contact immediately.
Actual Behavior
rigger the on Press event when click on particular contact after 3 to 5 seconds
this.state.contactList will contain the contacts list
<FlatList
data={this.state.contactList}
renderItem={({ item,index}) => (<UserContact onClick={() => this.navigateChat(item)} key={index} concatcInfo={item} />)}
keyExtractor={(item, index) => index+""}
/>
}
i tried in different ways to fix this issue but i am unable to fix this issue . event this issue reflect in child route there onPress event triggering after 3 to 5 seconds
Additional Information
Environment:
OS: Windows 10
Node: 8.9.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3
The text was updated successfully, but these errors were encountered: