flat-list-mvcp: Android Issue: Exception in native call from JS
This occurs on Android when changing FlatList data too rapidly
In addition to that there is a ref issue in the code - you assign an unnecessary ref and also block on the way the forwarded ref
<FlatList
{...props}
ref={(ref) => {
// @ts-ignore
flRef.current = ref;
typeof forwardedRef === 'function' && forwardedRef(ref);
}}
/>
Iโll submit a PR for the refs however, I still would like an insight on why it drops that error
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 37
Commits related to this issue
- Fixed un-necessary calls to resetMvcpIfNeeded Fixes - https://github.com/GetStream/flat-list-mvcp/issues/6 — committed to GetStream/flat-list-mvcp by vishalnarkhede 3 years ago
Have published
0.0.9
with latest changes. Thanks once again ๐I usually have 5-10 items in the list in the beginning, but with
0.0.9-dev.1
it seems to work most of the time (with the first one working every time). Around 80% of the times it works for me but once it even crashed with the same error if I scrolled very quickly in both directions. Havenโt been able to make it crash again though. For my usecase, this is probably good enough, but might not be for everyone.EDIT: 80% might be around 90-95% instead, it is working quite well now.
@karri-lehtiranta @rgbedin So I was trying to mess around some logic, and this looks like a decent middle ground: https://github.com/GetStream/flat-list-mvcp/pull/11/files
I have published
0.0.9-dev.0
and seems to be working well. Could you give it a shot โฆ and check if it works for your cases as well? ๐Basically if you have some
onScroll
handler which makes a call to setState - thenFlatList
invokes ref callback, which results in call toresetMvcpIfNeeded
. So I guess little debounce will do a trick here.Thanks in advance
@rgbedin I am looking into in as I type this ๐