@gitgw/use-fullscreen

1.0.3 • Public • Published

@gitgw/use-fullscreen

React Hook to make any element go Fullscreen.

Installation

npm

npm i @gitgw/use-fullscreen

yarn

yarn add @gitgw/use-fullscreen

Usage

import React from "react";
import useFullscreen from "@gitgw/use-fullscreen";

function App() {
  const onChange = (isFull) => {
    console.log("onChange");
  }
  const { element, enterFullScreen, exitFullScreen } = useFullscreen(onChange);

  return (
    <div className="App">
      <button onClick={enterFullScreen}>enterFullScreen</button>;
      <button onClick={exitFullScreen}>exitFullScreen</button>;
    </div>
  );
}

Arguments

Argument Type Description Arguments Required
onChange Function Function to be called when the screen goes Fullscreen or exits is isFull: Boolean no

Return

useFullscreen returns an object containing the following:

Return value Type Description
element React ref Ref to add to the element that you want to make fullscreen
enterFullScreen Function Function to make the element enter fullscreen
exitFullScreen Function Function to make the document exit fullscreen

Package Sidebar

Install

npm i @gitgw/use-fullscreen

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

3.26 kB

Total Files

4

Last publish

Collaborators

  • githubgw