Is your feature request related to a problem? Please describe.
The IntersectionObserver API has supported a scrollMargin option since last year (MDN). It appears as a field hint when programming in an IDE because our IntersectionOptions extends the browser's IntersectionObserverInit interface (here).
However, only the explicitly defined fields are destructured and used in useInView.
As a result, scrollMargin is silently dropped and has no effect or warning.
Describe the solution you'd like
useInView (and other APIs) should forward scrollMargin to IntersectionObserver.
Describe alternatives you've considered
It might be better to preserve any unused IntersectionObserverInit fields when passing them through, in case there are future updates to the API.
Additional context
Version of react-intersection-observer: 10.0.3
Is your feature request related to a problem? Please describe.
The
IntersectionObserverAPI has supported ascrollMarginoption since last year (MDN). It appears as a field hint when programming in an IDE because ourIntersectionOptionsextends the browser'sIntersectionObserverInitinterface (here).However, only the explicitly defined fields are destructured and used in
useInView.As a result,
scrollMarginis silently dropped and has no effect or warning.Describe the solution you'd like
useInView(and other APIs) should forwardscrollMargintoIntersectionObserver.Describe alternatives you've considered
It might be better to preserve any unused
IntersectionObserverInitfields when passing them through, in case there are future updates to the API.Additional context
Version of
react-intersection-observer: 10.0.3