@folklore/hooks 0.0.35 → 0.0.37

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.
package/dist/cjs.js CHANGED
@@ -617,17 +617,15 @@ function useResizeObserver() {
617
617
 
618
618
  function useIsVisible() {
619
619
  let {
620
- rootMargin,
621
- persist = false
620
+ persist = false,
621
+ ...opts
622
622
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
623
623
  const {
624
624
  ref,
625
625
  entry: {
626
626
  isIntersecting
627
627
  }
628
- } = useIntersectionObserver({
629
- rootMargin
630
- });
628
+ } = useIntersectionObserver(opts);
631
629
  const wasIntersecting = react.useRef(isIntersecting);
632
630
  if (isIntersecting && !wasIntersecting.current) {
633
631
  wasIntersecting.current = isIntersecting;
@@ -1402,6 +1400,9 @@ function useYouTubePlayer(id) {
1402
1400
  const elementRef = react.useRef(null);
1403
1401
  const playerRef = react.useRef(null);
1404
1402
  const playerElementRef = react.useRef(elementRef.current);
1403
+ if (elementRef.current !== null && playerElementRef.current !== null) {
1404
+ playerElementRef.current = elementRef.current;
1405
+ }
1405
1406
  const elementHasChanged = elementRef.current !== playerElementRef.current;
1406
1407
  const videoId = react.useMemo(() => getVideoId(id), [id]);
1407
1408
  const [ready, setReady] = react.useState(false);
package/dist/es.js CHANGED
@@ -606,17 +606,15 @@ function useResizeObserver() {
606
606
 
607
607
  function useIsVisible() {
608
608
  let {
609
- rootMargin,
610
- persist = false
609
+ persist = false,
610
+ ...opts
611
611
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
612
612
  const {
613
613
  ref,
614
614
  entry: {
615
615
  isIntersecting
616
616
  }
617
- } = useIntersectionObserver({
618
- rootMargin
619
- });
617
+ } = useIntersectionObserver(opts);
620
618
  const wasIntersecting = useRef(isIntersecting);
621
619
  if (isIntersecting && !wasIntersecting.current) {
622
620
  wasIntersecting.current = isIntersecting;
@@ -1391,6 +1389,9 @@ function useYouTubePlayer(id) {
1391
1389
  const elementRef = useRef(null);
1392
1390
  const playerRef = useRef(null);
1393
1391
  const playerElementRef = useRef(elementRef.current);
1392
+ if (elementRef.current !== null && playerElementRef.current !== null) {
1393
+ playerElementRef.current = elementRef.current;
1394
+ }
1394
1395
  const elementHasChanged = elementRef.current !== playerElementRef.current;
1395
1396
  const videoId = useMemo(() => getVideoId(id), [id]);
1396
1397
  const [ready, setReady] = useState(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/hooks",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "React hooks",
5
5
  "keywords": [
6
6
  "javascript",
@@ -49,7 +49,7 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "f667640e912d685cae90a8bdb8e391976f5d4969",
52
+ "gitHead": "74bc16333dab2c70f94aad9439d6daf55388e96e",
53
53
  "dependencies": {
54
54
  "@folklore/events": "^0.0.5",
55
55
  "@folklore/services": "^0.1.38",