You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@chiragrupani/fullscreen-react

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chiragrupani/fullscreen-react

Library to use full screen in ReactJS

1.2.5
latest
Source
npm
Version published
Weekly downloads
192
-30.94%
Maintainers
1
Weekly downloads
 
Created
Source

fullscreen-react

npm (scoped) npm

Build Status

Allows any html element to enter full screen using Browser API.

Installation

Install the package

npm i @chiragrupani/fullscreen-react

Usage

Use with class component or function component like below:

Class component example

<button onClick={e => this.setState({isFullScreen: true})}>Go Fullscreen</button>

<FullScreen
    isFullScreen={this.state.isFullScreen}
    onChange={(isFullScreen) => {
        this.setState({ isFullScreen });
    }}
    >
    <div>Fullscreen</div>
</FullScreen>

Function component example

export default function FSExampleHook() {
  let [isFullScreen, setFullScreen] = React.useState(false);

  return (
    <>
      <button onClick={(e) => setFullScreen(true)}>Go Fullscreen</button>

      <FullScreen
        isFullScreen={isFullScreen}
        onChange={(isFull: boolean) => {
          setFullScreen(isFull);
        }}
      >
        <div>Fullscreen</div>
      </FullScreen>
    </>
  );
}

If you require entire document in fullscreen instead of any specific element use DocumentFullScreen instead of FullScreen like below. However, there can be atmost one DocumentFullScreen:

<DocumentFullScreen
  isFullScreen={this.state.isFullScreen}
  onChange={(isFullScreen) => {
    this.setState({ isFullScreen });
  }}
>
  <div>Fullscreen</div>
</DocumentFullScreen>

Keywords

fullscreen react

FAQs

Package last updated on 02 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts