UNPKG

react-native-scroll-into-view

Version:

React-Native port of DOMElement.scrollIntoView() web function, for ScrollView

15 lines 577 B
import { useContext } from "react"; import Context from "./context"; function useScrollIntoViewContext() { const value = useContext(Context); if (value === null) { throw new Error("react-native-scroll-into-view context is missing. " + "Don't forget to wrap a scrollview with wrapScrollView(ScrollView) and use that ScrollView at the top of the component tree!"); } return value; } export function useScrollIntoView() { const { scrollIntoView } = useScrollIntoViewContext(); return scrollIntoView; } //# sourceMappingURL=hooks.js.map