@jacobp100/react-native-scrollintoview
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

react-native-scrollintoview

Scolls a parent ScrollView to ensure the view is visible

Installation

npm install @jacobp100/react-native-scrollintoview

Usage

import ScrollIntoView from '@jacobp100/react-native-scrollintoview';

const Example = () => {
  const ref = useRef();

  const scrollIntoView = () => {
    ref.current.scrollIntoView({
      behavior: 'smooth', // set to auto to disable animation
      inset: {
        top: 20,
        right: 20,
        bottom: 20,
        left: 20,
      }, // Add a margin around view when scrolling
    });
  };

  return (
    <ScrollView>
      <ScrollIntoView ref={ref} />
    </ScrollView>
  );
};

Also exports AnimatedComponent if you need to provide animated styles.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Package Sidebar

Install

npm i @jacobp100/react-native-scrollintoview

Weekly Downloads

0

Version

0.1.3

License

MIT

Unpacked Size

42.5 kB

Total Files

33

Last publish

Collaborators

  • jacobp100