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.
@@ -20651,6 +20651,7 @@ function useActiveCategoryScrollDetection(_ref) {
20651
20651
  var BodyRef = useBodyRef();
20652
20652
  React.useEffect(function () {
20653
20653
  var visibleCategories = new Map();
20654
+ var intersectingCategories = new Map();
20654
20655
  var bodyRef = BodyRef.current;
20655
20656
  var observer = new IntersectionObserver(function (entries) {
20656
20657
  if (!bodyRef) {
@@ -20663,17 +20664,20 @@ function useActiveCategoryScrollDetection(_ref) {
20663
20664
  continue;
20664
20665
  }
20665
20666
  visibleCategories.set(_id, entry.intersectionRatio);
20667
+ intersectingCategories.set(_id, entry.isIntersecting);
20666
20668
  }
20667
20669
  var ratios = Array.from(visibleCategories);
20668
- setVisibleCategories(ratios.filter(function (_ref2) {
20669
- var ratio = _ref2[1];
20670
- return ratio > 0;
20670
+ var visibleCats = ratios.filter(function (_ref2) {
20671
+ var id = _ref2[0],
20672
+ ratio = _ref2[1];
20673
+ return ratio > 0 || intersectingCategories.get(id);
20671
20674
  }).map(function (_ref3) {
20672
20675
  var id = _ref3[0];
20673
20676
  return id;
20674
- }));
20677
+ });
20678
+ setVisibleCategories(visibleCats);
20675
20679
  var lastCategory = ratios[ratios.length - 1];
20676
- if (lastCategory[1] == 1) {
20680
+ if ((lastCategory == null ? void 0 : lastCategory[1]) == 1) {
20677
20681
  return setActiveCategory(lastCategory[0]);
20678
20682
  }
20679
20683
  for (var _i = 0, _ratios = ratios; _i < _ratios.length; _i++) {
@@ -20686,11 +20690,15 @@ function useActiveCategoryScrollDetection(_ref) {
20686
20690
  }
20687
20691
  }
20688
20692
  }, {
20693
+ root: bodyRef,
20689
20694
  threshold: [0, 1]
20690
20695
  });
20691
20696
  bodyRef == null ? void 0 : bodyRef.querySelectorAll(asSelectors(ClassNames.category)).forEach(function (el) {
20692
20697
  observer.observe(el);
20693
20698
  });
20699
+ return function () {
20700
+ observer.disconnect();
20701
+ };
20694
20702
  }, [BodyRef, setActiveCategory, setVisibleCategories]);
20695
20703
  }
20696
20704