Skip to content

Detects if a ScrollView or ListView element is inside the users viewport and reports back on changes

Notifications You must be signed in to change notification settings

pavlealeksic/react-native-isinview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

react-native-isinview

Detects if a ScrollView or ListView element is inside the users viewport and reports back on changes

##Install

npm i -S react-native-isinview

or with yarnpkg:

yarn add react-native-isinview --save

##Props

  • onChange (required): callback function that report true or false if component is in view.
  • active : if set true it will activate a listener to the view (default: true).
  • delay : set the frequency for the listener (default: 200).

##Uage

import IsInview from 'react-native-isinview'

render() {
  return (
  <ScrollView>
    <IsInview onChange={inView => console.log('Inview: '+ inView)}>
      ....
    </IsInview>

    <IsInview onChange={inView => console.log('Inview: '+ inView)}>
      ....
    </IsInview>

  </ScrollView>
  );
}

About

Detects if a ScrollView or ListView element is inside the users viewport and reports back on changes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published