0.1.3 • Published 1 year ago

@jacobp100/react-native-scrollintoview v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago