Scolls a parent ScrollView to ensure the view is visible
npm install @jacobp100/react-native-scrollintoviewimport 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.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library