Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
react-native-infinite-flatlist-patch
Advanced tools
Infinite scrolling is one of the most used UX in App. In React Native, This is implemented using the onEndReached
props of FlatList.
Unfortunately, It doesn't work well as expected. I think it's one of the headaches that hasn't been solved for quite some time. We had to make it work by modifying onEndReachedThreshold
several times, but eventually it doesn't work efficiently.
Now, This patch will make it work as you expect! It's too easy to use.
My PR is in progress, but React Native may not be easy to apply because there are so many things to consider. So, I decided to provide this patch for those who needed it.
Once installed, react-native's FlatList is automatically patched.
yarn add react-native-infinite-flatlist-patch --dev
postinstall
, postuninstall
should be added to prevent this patch from being restored whenever packages are changed.
{
...
"scripts": {
...,
"postinstall": "yarn run infinite-flatlist-patch",
"postuninstall": "yarn run infinite-flatlist-patch"
}
}
If you were already using postinstall
, you can add the patch script later.
"postinstall": "yarn run jetify; yarn run infinite-flatlist-patch"
You can execute the patch manually with the command below.
yarn run infinite-flatlist-patch
Just delete the command you added to postinstall
, postuninstall
and remove my package.
You can test it yourself with this test app.
This app is to test the improvements of onEndReached
of FlatList.
onEndReached
is called, 10 items are added.OnEndReached
is called and FlatList has 30 items.
OnEndReached
is not called and FlatList has 20 items.
OnEndReached
is called twice in a short period and FlatList has 50 items.
OnEndReached
is called and FlatList has 30 items.
FAQs
Patch for infinite scrolling with FlatList
The npm package react-native-infinite-flatlist-patch receives a total of 24 weekly downloads. As such, react-native-infinite-flatlist-patch popularity was classified as not popular.
We found that react-native-infinite-flatlist-patch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.