emoji-picker-react 4.15.0 → 4.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20650,6 +20650,7 @@ function useActiveCategoryScrollDetection(_ref) {
20650
20650
  var BodyRef = useBodyRef();
20651
20651
  useEffect(function () {
20652
20652
  var visibleCategories = new Map();
20653
+ var intersectingCategories = new Map();
20653
20654
  var bodyRef = BodyRef.current;
20654
20655
  var observer = new IntersectionObserver(function (entries) {
20655
20656
  if (!bodyRef) {
@@ -20662,17 +20663,20 @@ function useActiveCategoryScrollDetection(_ref) {
20662
20663
  continue;
20663
20664
  }
20664
20665
  visibleCategories.set(_id, entry.intersectionRatio);
20666
+ intersectingCategories.set(_id, entry.isIntersecting);
20665
20667
  }
20666
20668
  var ratios = Array.from(visibleCategories);
20667
- setVisibleCategories(ratios.filter(function (_ref2) {
20668
- var ratio = _ref2[1];
20669
- return ratio > 0;
20669
+ var visibleCats = ratios.filter(function (_ref2) {
20670
+ var id = _ref2[0],
20671
+ ratio = _ref2[1];
20672
+ return ratio > 0 || intersectingCategories.get(id);
20670
20673
  }).map(function (_ref3) {
20671
20674
  var id = _ref3[0];
20672
20675
  return id;
20673
- }));
20676
+ });
20677
+ setVisibleCategories(visibleCats);
20674
20678
  var lastCategory = ratios[ratios.length - 1];
20675
- if (lastCategory[1] == 1) {
20679
+ if ((lastCategory == null ? void 0 : lastCategory[1]) == 1) {
20676
20680
  return setActiveCategory(lastCategory[0]);
20677
20681
  }
20678
20682
  for (var _i = 0, _ratios = ratios; _i < _ratios.length; _i++) {
@@ -20685,11 +20689,15 @@ function useActiveCategoryScrollDetection(_ref) {
20685
20689
  }
20686
20690
  }
20687
20691
  }, {
20692
+ root: bodyRef,
20688
20693
  threshold: [0, 1]
20689
20694
  });
20690
20695
  bodyRef == null ? void 0 : bodyRef.querySelectorAll(asSelectors(ClassNames.category)).forEach(function (el) {
20691
20696
  observer.observe(el);
20692
20697
  });
20698
+ return function () {
20699
+ observer.disconnect();
20700
+ };
20693
20701
  }, [BodyRef, setActiveCategory, setVisibleCategories]);
20694
20702
  }
20695
20703