Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-infinite-scrolling

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-infinite-scrolling

A react native package for infinite scrolling of list

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
101
increased by106.12%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-infinite-scrolling

A react native package developed to implement infinite scrolling in any react-native app.

Getting Started

Install via npm

npm i react-native-infinite-scrolling

Usage

Import the InfiniteScroll component from react-native-infinite-scrolling:

import InfiniteScroll from 'react-native-infinite-scrolling'

This component accepts 3 parameters / props:

  1. data: It contains data in form of an array which will be mapped.
  2. renderData: It accepts a function which returns the mapped data. It accepts a single parameter which indicates a single element of the data array.
  3. loadMore: It also accepts a function which will load more data once the bottom of the page is reached while scrolling.

Usage Example:

import InfiniteScroll from 'react-native-infinite-scrolling'

const TestingApplication = () => {
  const [data, setData] = useState([])
  useEffect(() => {
    loadMore()
  },[])

  const renderData = ({ item }) => {
    return(
      <View>
        <Text> {item.title} </Text>
        <Text> {item.id} </Text>
      </View>
    )
  }

  const loadMore = () => {
    axios.get('https://jsonplaceholder.typicode.com/todos?_limit=10')
    .then((response) => {
      let updatedData = data.concat(response.data)
      setData(updatedData)
    })
    .catch((error) => console.log('error =', error))
  }
  return(
    <InfiniteScroll 
      renderData = {renderData}
      data = { data }
      loadMore = { loadMore }
    />
  )
}

export default TestingApplication

Build with:

  1. React
  2. react-native
  3. Hooks

Keywords

FAQs

Package last updated on 27 Jan 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc