# react-mobile-fullscreen

> fullscreen manager for mobile devices

Latest version **1.0.1** (published 2021-01-23) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install react-mobile-fullscreen
pnpm add react-mobile-fullscreen
yarn add react-mobile-fullscreen
bun add react-mobile-fullscreen
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-01-23 |
| First published | 2021-01-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 41 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | nothingkid |
| Maintainers | nothingkid |
| Keywords | react, fulscreen, full screen, minimal ui, mobile, mobile fullscreen, mobile full screen, hide adress bar |

## Links

- npm: https://www.npmjs.com/package/react-mobile-fullscreen
- Repository: https://github.com/nothingkid/react-mobile-fullscreen
- Homepage: https://github.com/nothingkid/react-mobile-fullscreen#readme
- Issues: https://github.com/nothingkid/react-mobile-fullscreen/issues
- npm.io page: https://npm.io/package/react-mobile-fullscreen

## Dependencies (3)

- [fscreen](https://npm.io/package/fscreen.md) ^1.1.0
- [debounce](https://npm.io/package/debounce.md) ^1.2.0
- [is-mobile](https://npm.io/package/is-mobile.md) ^2.2.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-01-23
- 1.0.0 — 2021-01-23

## README

# React Mobile Fullscreen

Lib tries to use native fullscreen api and only if api is not supported it fallbacks to use `MinimalUI` (name of react component used internally).
minimal-ui (name of safari mode when adress bar is hidden) is what `brim` uses (https://github.com/gajus/brim), but unlike react-mobile-fullscreen, android devices are not supported by `brim`.

If native fullscreen api is supported, then fullscreen can be activated from user action such as click.

Otherwise, `MinimalUI` component will be used. In this case, user must swipe up to hide adress bar.

To detect device type (mobile or desktop) you can use `react-device-detect` (https://github.com/duskload/react-device-detect).

Use `useFullScreenContext` if you need to know about current `view` and/or `fullscreenType` in children components for some reason.

# Usage

### Install

```bash
npm install -S react-mobile-fullscreen
```

### Basic Setup

```jsx
const Mask = (props: IMaskProps) => {
    return (
        <div
            style={{
                background:
                    props.fullscreenType === "native" ? "blue" : "green",
                width: "100%",
                height: "100%",
            }}
        >
            {props.fullscreenType === "native"
                ? "Click Me!"
                : props.fullscreenType === "minimal-ui"
                ? "Swipe Up!"
                : "Mask won't be rendered"}
        </div>
    );
};

export function App() {
    return (
        <MobileFullscreen mask={Mask}>
            <div
                style={{
                    width: "100%",
                    height: "100%",
                    background: "pink",
                }}
            >
                <div>Main Content</div>
            </div>
        </MobileFullscreen>
    );
}
```

## Types

```ts
type View = "full" | "default";
type FullscreenType = "native" | "minimal-ui" | null;

interface IMaskProps {
    fullscreenType: FullscreenType;
}

type MaskComponent = React.ComponentType<IMaskProps>;

interface IFullScreen {
    view: View;
    fullscreenType: FullscreenType;
}

const useFullScreenContext: () => IFullSscreen;

interface IMobileFullscreenProps {
    mask: MaskComponent;
    children: React.ReactNode | React.ReactNodeArray;
}
```

---
_Source: https://npm.io/package/react-mobile-fullscreen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
