
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
react-native-autoscroll-flatlist
Advanced tools
An enhanced React Native FlatList component to provide auto-scrolling functionality
An enhanced version of the original react-native <FlatList>
component with built-in support for both Javascript and Typescript usage.
This component enables auto-scrolling on new item added to the list - which works like any chat client.
Now supports horizontal <FlatList>
as well in version >= 1.6.0
.
Auto-scroll is disabled when scrolled away from end of list. There are 3 ways to re-enable auto-scrolling:
scrollToEndIndicator
(customizable) shown on the bottom right of the list.newMessageAlertComponent
(customizable) shown on the top of the list.inverted
to the props.horizontal
to the props.npm install --save react-native-autoscroll-flatlist
or
yarn add react-native-autoscroll-flatlist
Import the component with:
import {AutoScrollFlatList} from "react-native-autoscroll-flatlist";
and simply use it like an ordinary <FlatList>
, for example:
<AutoScrollFlatList
ref={this.myRef}
threshold={20}
data={myData}
renderItem={({item, index}) => <YourComponent item={item} index={index} />}
keyExtractor={item => item.id}
/>
You can check out the example
folder for further details.
You can check out App.tsx
, or replace it with the content of App-Horizontal.tsx
to try out usage in landscape orientation.
Note that the landscape demo does not work in react-native-web because of the constraint with ScreenOrientation
not being able to lock it to horizontal.
This component extends the official FlatListProps
with the following additional props:
You can read the type definitions file for more details and explanations.
This component extends the official FlatList Methods
with the following modified / additional methods:
Method | Parameters | Description |
---|---|---|
scrollToEnd | params: {animated: boolean} = {animated: true} | Set newItemCount to 0 and then trigger scrollToOffset to end of page. |
isAutoScrolling | Returns whether auto-scrolling (boolean) is in effect. |
There are certain caveats for usage on react-native-web:
Q: My page keeps expanding in height and the autoscroll function is not being triggered. How do I fix this?
A: For usage in react-native, usually add a flex property such as flex: 1
to the container would be sufficient to get FlatList working.
However, when it comes to react-native-web, you will have to explicitly set the height of the container such that it will not keep expanding.
To do so, a simple fix would be to add
height: Dimensions.get("window").height
maxHeight: Dimensions.get("window").height
to the container style (depending on your use cases).
FAQs
An enhanced React Native FlatList component to provide auto-scrolling functionality
The npm package react-native-autoscroll-flatlist receives a total of 335 weekly downloads. As such, react-native-autoscroll-flatlist popularity was classified as not popular.
We found that react-native-autoscroll-flatlist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.