Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

Version published
Weekly downloads
380
increased by22.58%
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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc