Skip to content

Releases: thebuilder/react-intersection-observer

v8.28.2

08 Sep 07:52
9de54b7

Choose a tag to compare

8.28.2 (2020-09-08)

Bug Fixes

v8.28.1

07 Sep 12:21

Choose a tag to compare

8.28.1 (2020-09-07)

Bug Fixes

  • There was an issue with the CJS and UMD files generated by microbundle, not matching filename in package.json

v8.28.0

07 Sep 11:55
1537592

Choose a tag to compare

8.28.0 (2020-09-07)

Features

Details

This is a rewrite of the internal handling of IntersectionObservers, alongside general refactoring and alignment of the code.

  • Breaking change: Remove default export for the InView component
  • Remove outdated fixes for the initial IntersectionObserver browser implementation. These were needed 3 years ago, to ensure all browsers acted according to the spec
  • Support multiple observers on the same element. Closes #340
  • Rewrite tests, so they use test-utils to properly mock the IntersectionObserver instances
  • Switch to microbundle for compiling
  • Add initial IntersectionObserver v2 support. Closes #368

IntersectionObserver v2 🧪

The new
v2 implementation of IntersectionObserver
extends the original API, so you can track if the element is covered by another
element or has filters applied to it. Useful for blocking clickjacking attempts
or tracking ad exposure.

To use it, you'll need to add the new trackVisibility and delay options.
When you get the entry back, you can then monitor if isVisible is true.

const TrackVisible = () => {
  const { ref, entry } = useInView({ trackVisibility: true, delay: 100 });
  return <div ref={ref}>{entry?.isVisible}</div>;
};

This is still a very new addition, so check
caniuse for current browser
support. If trackVisibility has been set, and the current browser doesn't
support it, a fallback has been added to always report isVisible as true.

It's not added to the TypeScript lib.d.ts file yet, so you will also have to
extend the IntersectionObserverEntry with the isVisible boolean.

v8.28.0-beta.2

01 Sep 09:50

Choose a tag to compare

v8.28.0-beta.2 Pre-release
Pre-release

8.28.0-beta.2 (2020-09-01)

Features

  • add initial support for IntersectionObserver v2 (9d53139)

v8.28.0-beta.1

30 Aug 21:56

Choose a tag to compare

v8.28.0-beta.1 Pre-release
Pre-release

8.28.0-beta.1 (2020-08-30)

Features

  • rewrite internals and tests (4b0d1a7)

v8.27.1

20 Aug 19:13
7aa5d74

Choose a tag to compare

8.27.1 (2020-08-20)

Bug Fixes

  • shouldn't trigger onchange when skipping (#365) (7aa5d74)

v8.27.0

19 Aug 15:25
6b4bd6d

Choose a tag to compare

8.27.0 (2020-08-19)

Features

v8.26.2

24 Apr 13:04
d1e1495

Choose a tag to compare

8.26.2 (2020-04-24)

Bug Fixes

  • don't clear the inView state if we get a node (#337) (d1e1495), closes #308

v8.26.1

26 Feb 09:44

Choose a tag to compare

  • fix: the inView state could be reset with triggerOnce #311 (#312) a18d398

v8.26.0...v8.26.1

v8.26.0

23 Feb 21:55

Choose a tag to compare

v8.25.3...v8.26.0