Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@stream-io/flat-list-mvcp
Advanced tools
`maintainVisibleContentPosition` support for Android react-native
maintainVisibleContentPosition
prop support for Android react-native.[ Built with ♥ at Stream ]
In react-native, ScrollView (and FlatList) component have support for a prop maintainVisibleContentPosition
, which is really useful for chat-like applications where you want to see new messages scroll into place. Also you might need it in other applications where you need bi-directional infinite scroll. Although currently its only supported on iOS. So here we have built a simple wrapper for FlatList and ScrollView to add support for this prop for android. On iOS, we simply return FlatList and ScrollView from react-native package.
We built this wrapper for our in-house react-native chat sdk, but we are making it public, in case it helps other devs from react-native community.
Before you proceed, please don't forget to also check other relevant packages, built at Stream:
# clone the repo
git clone https://github.com/GetStream/flat-list-mvcp.git
cd flat-list-mvcp/Example
# Install npm and pod dependencies
yarn; npx pod-install;
# run the app
npx react-native run-android
yarn add @stream-io/flat-list-mvcp
import { FlatList, ScrollView } from '@stream-io/flat-list-mvcp';
<FlatList
maintainVisibleContentPosition={{
autoscrollToTopThreshold: 10,
minIndexForVisible: 1,
}}
...
/>
<ScrollView
maintainVisibleContentPosition={{
autoscrollToTopThreshold: 10,
minIndexForVisible: 1,
}}
...
/>
This package doesn't support Expo managed workflow. There is a feature request open for expo - https://expo.canny.io/feature-requests/p/android-maintainvisiblecontentposition-on-flatlist (please upvote)
Thanks to stackia for https://github.com/facebook/react-native/pull/29466#issuecomment-664367382
PRs for improvement are welcome :)
MIT
FAQs
`maintainVisibleContentPosition` support for Android react-native
The npm package @stream-io/flat-list-mvcp receives a total of 18,192 weekly downloads. As such, @stream-io/flat-list-mvcp popularity was classified as popular.
We found that @stream-io/flat-list-mvcp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.