What is the current behavior?
Currently, useFullscreen is expecting a non nullable ref (RefObject<HTMLElement>) as first parameter, which is something impossible to be passed since using both react's useRef or createRef to save a ref to an HTMLElement would always return a RefObject<HTMLElement | null>.
This issue is only valid when using Typescript in your project.
Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:
https://codesandbox.io/p/sandbox/react-use-j4wx8w
What is the expected behavior?
useFullscreen should accept a RefObject<HTMLElement | null> as first parameter instead of RefObject<HTMLElement> as even in the source code, there is a check if the passed ref.current is falsy before doing any operation on it in the main useEffect.
A little about versions:
- OS: MacOS Sequoia 15.6
- Browser (vendor and version): Chrome v139.0.7258.128 arm64
- React: v19.1.1
react-use: v17.6.0
- Did this worked in the previous package version? No, it worked when you use a react version older than v19 (v18 and below)
What is the current behavior?
Currently,
useFullscreenis expecting a non nullable ref (RefObject<HTMLElement>) as first parameter, which is something impossible to be passed since using both react'suseReforcreateRefto save a ref to an HTMLElement would always return aRefObject<HTMLElement | null>.This issue is only valid when using Typescript in your project.
Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than
react-use. Paste the link to your JSFiddle or CodeSandbox example below:https://codesandbox.io/p/sandbox/react-use-j4wx8w
What is the expected behavior?
useFullscreenshould accept aRefObject<HTMLElement | null>as first parameter instead ofRefObject<HTMLElement>as even in the source code, there is a check if the passedref.currentis falsy before doing any operation on it in the mainuseEffect.A little about versions:
react-use: v17.6.0