diff --git a/README.md b/README.md
index 46e4f80..9ed4235 100644
--- a/README.md
+++ b/README.md
@@ -21,20 +21,16 @@ On iOS, install pods in your app's `ios` directory. Android links automatically
## Usage
```tsx
-import { View } from "react-native";
-import {
- ReservedRegionsProvider,
- useReservedRegions,
-} from "react-native-reserved-regions";
+import { View } from 'react-native';
+import { ReservedRegionsProvider, useReservedRegions } from 'react-native-reserved-regions';
function Screen() {
const fold = useReservedRegions().find(
- (region) =>
- region.kind === "division" && region.frame.height > region.frame.width,
+ (region) => region.kind === 'division' && region.frame.height > region.frame.width,
);
if (!fold) return ;
return (
-
+
@@ -62,12 +58,12 @@ The public type is a tagged union:
```ts
type ReservedRegion =
| {
- kind: "division";
+ kind: 'division';
frame: { x: number; y: number; width: number; height: number };
occludesContent: boolean;
}
| {
- kind: "occlusion";
+ kind: 'occlusion';
frame: { x: number; y: number; width: number; height: number };
};
```
diff --git a/website/docusaurus.config.mjs b/website/docusaurus.config.mjs
index f34dbae..0804631 100644
--- a/website/docusaurus.config.mjs
+++ b/website/docusaurus.config.mjs
@@ -3,7 +3,7 @@ import { themes } from 'prism-react-renderer';
export default {
title: 'Reserved Regions',
tagline: 'Display divisions and occlusions in your React Native view coordinates.',
- favicon: 'img/mark.svg',
+ favicon: 'img/logo.png',
url: 'https://appandflow.github.io',
baseUrl: '/react-native-reserved-regions/',
organizationName: 'appandflow',
diff --git a/website/src/component/ConceptCard.jsx b/website/src/component/ConceptCard.jsx
new file mode 100644
index 0000000..3d5e50e
--- /dev/null
+++ b/website/src/component/ConceptCard.jsx
@@ -0,0 +1,33 @@
+import React from 'react';
+import Link from '@docusaurus/Link';
+import Illustration from './Illustration';
+import styles from '../css/ConceptCard.module.css';
+import shared from '../css/shared.module.css';
+
+export default function ConceptCard({ concept, isFirst }) {
+ return (
+
+
{concept.title}
+
{concept.description}
+
+ {concept.label} ↗
+
+
+
+ );
+}
diff --git a/website/src/component/Illustration.jsx b/website/src/component/Illustration.jsx
new file mode 100644
index 0000000..246bcf4
--- /dev/null
+++ b/website/src/component/Illustration.jsx
@@ -0,0 +1,39 @@
+import React, { useEffect, useRef } from 'react';
+import useBaseUrl from '@docusaurus/useBaseUrl';
+import styles from '../css/Illustration.module.css';
+
+export default function Illustration({ file, alt, width, height, style, reveal = false, className = '' }) {
+ const imageRef = useRef(null);
+ useEffect(() => {
+ if (!reveal || !('IntersectionObserver' in window)) return;
+ const image = imageRef.current;
+ image.dataset.reveal = 'pending';
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry.isIntersecting) {
+ image.dataset.reveal = 'visible';
+ observer.disconnect();
+ }
+ },
+ {
+ threshold: 0.15,
+ },
+ );
+ observer.observe(image);
+ return () => {
+ observer.disconnect();
+ delete image.dataset.reveal;
+ };
+ }, [reveal]);
+ return (
+
+ );
+}
diff --git a/website/src/css/ConceptCard.module.css b/website/src/css/ConceptCard.module.css
new file mode 100644
index 0000000..5afd7de
--- /dev/null
+++ b/website/src/css/ConceptCard.module.css
@@ -0,0 +1,23 @@
+.concept {
+ padding: 28px 24px 0;
+ border: 1px solid rgba(18, 18, 18, 0.1);
+ overflow: hidden;
+}
+
+.conceptDescription {
+ margin: 16px 0;
+}
+
+.concept a:hover {
+ color: #008cff;
+}
+
+.conceptIllustration {
+ margin: 64px auto 0;
+}
+
+@media (width <= 600px) {
+ .conceptIllustration {
+ margin: 40px auto 0;
+ }
+}
diff --git a/website/src/css/Illustration.module.css b/website/src/css/Illustration.module.css
new file mode 100644
index 0000000..fa8ae68
--- /dev/null
+++ b/website/src/css/Illustration.module.css
@@ -0,0 +1,18 @@
+.illustration {
+ display: block;
+ width: 100%;
+ height: auto;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+ .illustrationReveal {
+ transition:
+ opacity 600ms ease,
+ translate 600ms cubic-bezier(0.22, 1, 0.36, 1);
+ }
+
+ .illustrationReveal[data-reveal='pending'] {
+ opacity: 0;
+ translate: 0 12px;
+ }
+}
diff --git a/website/src/css/custom.css b/website/src/css/custom.css
index 4915e8c..a6b4ce4 100644
--- a/website/src/css/custom.css
+++ b/website/src/css/custom.css
@@ -1,3 +1,27 @@
+@font-face {
+ font-family: 'GT Maru';
+ src: url('../font/GT-Maru-Bold.ttf') format('truetype');
+ font-style: normal;
+ font-weight: 700;
+ font-display: swap;
+}
+
+@font-face {
+ font-family: 'Inter';
+ src: url('../font/InterVariable.woff2') format('woff2');
+ font-style: normal;
+ font-weight: 100 900;
+ font-display: swap;
+}
+
+@font-face {
+ font-family: 'JetBrains Mono';
+ src: url('../font/JetBrainsMono-Regular.woff2') format('woff2');
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+}
+
:root {
--ifm-color-primary: #315de0;
--ifm-color-primary-dark: #204ccd;
diff --git a/website/src/css/index.module.css b/website/src/css/index.module.css
new file mode 100644
index 0000000..ee8ca12
--- /dev/null
+++ b/website/src/css/index.module.css
@@ -0,0 +1,263 @@
+.codeBlock {
+ box-shadow: none !important;
+ background: #fafafa !important;
+ border: 1px solid #e1dedef6;
+ border-radius: 8px;
+ overflow: hidden;
+}
+
+.codeBlock pre {
+ background: #fafafa !important;
+ overflow-x: auto;
+}
+
+.codeBlock pre,
+.codeBlock code {
+ white-space: pre-wrap !important;
+ overflow-wrap: anywhere !important;
+ word-break: normal !important;
+}
+
+.codeBlock button[aria-label='Toggle word wrap'] {
+ display: none;
+}
+
+.codeBlock code,
+.codeBlock :global(.token-line),
+.codeBlock :global(.token) {
+ color: #663cb5 !important;
+}
+
+.codeBlock :global(.token.plain),
+.codeBlock :global(.token.variable),
+.codeBlock :global(.token.parameter) {
+ color: #008cff !important;
+}
+
+.codeBlock :global(.token.keyword),
+.codeBlock :global(.token.operator) {
+ color: #f97583 !important;
+}
+
+.codeBlock :global(.token.string) {
+ color: #ffab70 !important;
+}
+
+.button {
+ position: relative;
+ overflow: hidden;
+ isolation: isolate;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ padding: 8px 16px;
+ border-radius: 40px;
+ background: #000;
+ color: #fff;
+ font-size: 12px;
+ font-weight: 500;
+ text-decoration: none;
+ white-space: nowrap;
+}
+
+.button::before {
+ content: '';
+ position: absolute;
+ inset: -50% -10%;
+ background: #008cff;
+ border-radius: 45% 55% 0 0;
+ transform: translateY(100%);
+ transition: transform 700ms ease;
+ pointer-events: none;
+ z-index: -1;
+}
+
+.button:hover::before {
+ transform: translateY(0);
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .button::before {
+ transition: none;
+ }
+}
+
+.page {
+ min-height: 100vh;
+ background: #fff;
+ color: #121212;
+ font-family: Inter, system-ui, sans-serif;
+ font-size: 14px;
+ line-height: 1.5;
+ --ifm-heading-color: #121212;
+ --ifm-link-color: #008cff;
+ --ifm-font-family-monospace: 'JetBrains Mono', ui-monospace, monospace;
+}
+
+.page code {
+ font-family: 'JetBrains Mono', ui-monospace, monospace;
+}
+
+.container {
+ width: calc(100% - 48px);
+ max-width: 520px;
+ margin: 0 auto;
+ padding: 120px 0 160px;
+}
+
+@media (width <= 600px) {
+ .container {
+ width: calc(100% - 40px);
+ padding: 20px 0 160px;
+ }
+}
+
+.navigation {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 16px;
+ margin-bottom: 48px;
+ font-size: 12px;
+ line-height: 1.4;
+}
+
+.logo {
+ width: 32px;
+ height: 32px;
+}
+
+.navLink {
+ color: #828282;
+}
+
+.githubLink {
+ color: #828282;
+ display: flex;
+ gap: 5px;
+}
+
+.githubIcon {
+ width: 16px;
+ height: 16px;
+ flex-shrink: 0;
+}
+
+.title {
+ margin: 0 0 16px;
+ color: #000;
+ font-size: clamp(30px, 5vw, 36px);
+ font-family: 'GT Maru', Inter, sans-serif;
+ font-weight: 700;
+ line-height: 1.12;
+ letter-spacing: -0.8px;
+ width: min(350px, 100%);
+}
+
+.intro {
+ margin: 0;
+}
+
+.heroIllustration {
+ margin: 48px 0;
+}
+
+.actions {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 16px;
+}
+
+.install {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 8px;
+ min-width: 0;
+}
+
+.installCommand {
+ padding: 0;
+ border: 0;
+ background: transparent;
+ color: #828282;
+ font-size: 12px;
+ overflow-wrap: anywhere;
+}
+
+.copyButton {
+ padding: 8px;
+ cursor: pointer;
+}
+
+.copyIcons {
+ display: grid;
+ width: 16px;
+ height: 16px;
+}
+
+.copyIcon {
+ grid-area: 1 / 1;
+ transition: all var(--ifm-transition-fast) ease;
+}
+
+.copySuccess {
+ grid-area: 1 / 1;
+ color: #00d600;
+ transition: all var(--ifm-transition-fast) ease;
+}
+
+.concepts {
+ margin-top: 32px;
+}
+
+.usage {
+ margin-top: 64px;
+}
+
+.usageIntro {
+ padding: 20px 0;
+}
+
+.usageDescription {
+ margin: 0 0 20px;
+}
+
+.example {
+ padding: 20px 0;
+}
+
+.exampleDescription {
+ margin: 0 0 20px;
+}
+
+.exampleButton {
+ font-size: 14px;
+ gap: 8px;
+}
+
+.icon {
+ width: 16px;
+ height: 16px;
+}
+
+.footer {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin-top: 32px;
+ padding: 16px 0;
+ border-top: 1px solid rgba(18, 18, 18, 0.05);
+ font-size: 12px;
+}
+
+.button:hover {
+ color: #fff;
+ text-decoration: none;
+}
+
+.navLink:hover,
+.githubLink:hover {
+ color: #828282;
+}
diff --git a/website/src/css/shared.module.css b/website/src/css/shared.module.css
new file mode 100644
index 0000000..4dbaae7
--- /dev/null
+++ b/website/src/css/shared.module.css
@@ -0,0 +1,36 @@
+.heading {
+ font-family: 'Inter', sans-serif;
+ font-weight: 600;
+ font-style: normal;
+ font-size: 16px;
+ line-height: 100%;
+ letter-spacing: -0.02em;
+ margin: 0;
+ color: #121212;
+}
+
+.description {
+ font-family: 'Inter', sans-serif;
+ font-weight: 400;
+ font-size: 14px;
+ line-height: 150%;
+ letter-spacing: -0.01em;
+}
+
+.textLink {
+ color: #008cff;
+}
+
+.link span {
+ display: inline-block;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+ .link span {
+ transition: transform 180ms ease;
+ }
+
+ .link:is(:hover, :focus-visible) span {
+ transform: translate(2px, -2px);
+ }
+}
diff --git a/website/src/font/GT-Maru-Bold.ttf b/website/src/font/GT-Maru-Bold.ttf
new file mode 100644
index 0000000..59871bd
Binary files /dev/null and b/website/src/font/GT-Maru-Bold.ttf differ
diff --git a/website/src/font/Inter-LICENSE.txt b/website/src/font/Inter-LICENSE.txt
new file mode 100644
index 0000000..9b2ca37
--- /dev/null
+++ b/website/src/font/Inter-LICENSE.txt
@@ -0,0 +1,92 @@
+Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION AND CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/website/src/font/InterVariable.woff2 b/website/src/font/InterVariable.woff2
new file mode 100644
index 0000000..5a8d3e7
Binary files /dev/null and b/website/src/font/InterVariable.woff2 differ
diff --git a/website/src/font/JetBrainsMono-OFL.txt b/website/src/font/JetBrainsMono-OFL.txt
new file mode 100644
index 0000000..5ceee00
--- /dev/null
+++ b/website/src/font/JetBrainsMono-OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/website/src/font/JetBrainsMono-Regular.woff2 b/website/src/font/JetBrainsMono-Regular.woff2
new file mode 100644
index 0000000..66c5467
Binary files /dev/null and b/website/src/font/JetBrainsMono-Regular.woff2 differ
diff --git a/website/src/pages/index.jsx b/website/src/pages/index.jsx
index 94856ff..f5f41d0 100644
--- a/website/src/pages/index.jsx
+++ b/website/src/pages/index.jsx
@@ -1,9 +1,17 @@
-import React from 'react';
-import Layout from '@theme/Layout';
+import ConceptCard from '../component/ConceptCard';
+import Illustration from '../component/Illustration';
+import styles from '../css/index.module.css';
+import shared from '../css/shared.module.css';
+import React, { useEffect, useRef, useState } from 'react';
+import LayoutProvider from '@theme/Layout/Provider';
+import SkipToContent from '@theme/SkipToContent';
+import { PageMetadata, SkipToContentFallbackId } from '@docusaurus/theme-common';
import Link from '@docusaurus/Link';
+import useBaseUrl from '@docusaurus/useBaseUrl';
import CodeBlock from '@theme/CodeBlock';
-import styles from './index.module.css';
-
+import packageJson from '../../../package.json';
+const github = 'https://github.com/appandflow/react-native-reserved-regions';
+const command = 'npm install react-native-reserved-regions';
const snippet = `const regions = useReservedRegions();
for (const region of regions) {
@@ -13,183 +21,227 @@ for (const region of regions) {
const { x, y, width, height } = region.frame;
}`;
-
-const portraitFrame = { width: 669, height: 951 };
-const portraitRegions = {
- division: { x: 0, y: 475.5, width: 669, height: 0 },
- occlusion: { x: 573, y: 42, width: 54, height: 54 },
-};
-
-function rotateClockwise({ x, y, width, height }) {
- return {
- x: portraitFrame.height - y - height,
- y: x,
- width: height,
- height: width,
- };
-}
-
-function RegionLabel({ kind, frame }) {
+const concepts = [
+ {
+ title: 'View-relative coordinates',
+ description: 'Measure a whole screen or a smaller panel. Each provider establishes its own coordinate space.',
+ label: 'Coordinates',
+ to: '/docs/coordinates',
+ image: 'coordinates.png',
+ maxWidth: 456,
+ width: 1368,
+ height: 599,
+ alt: 'A nested provider establishes coordinates relative to its container.',
+ },
+ {
+ title: 'Divisions and occlusions',
+ description:
+ 'A tagged union distinguishes divisions from occlusions. Divisions also tell you whether content is hidden.',
+ label: 'API reference',
+ to: '/docs/api',
+ image: 'occlusions.png',
+ maxWidth: 456,
+ width: 1368,
+ height: 640,
+ alt: 'Phone displays with camera occlusions and usable content areas.',
+ },
+ {
+ title: 'iOS and Android',
+ description:
+ 'UIKit reserved regions and Android folding features share an API with documented platform differences.',
+ label: 'Platform support',
+ to: '/docs/platforms',
+ image: 'platforms.png',
+ maxWidth: 448,
+ width: 1344,
+ height: 588,
+ alt: 'Foldable and conventional devices on iOS and Android.',
+ },
+];
+export default function Home() {
+ const [copyStatus, setCopyStatus] = useState('');
+ const resetTimer = useRef(null);
+ const copied = copyStatus === 'Copied';
+ const copyIcon = useBaseUrl('/img/copy-05.png');
+ useEffect(() => () => clearTimeout(resetTimer.current), []);
+ async function copyCommand() {
+ try {
+ await navigator.clipboard.writeText(command);
+ clearTimeout(resetTimer.current);
+ setCopyStatus('Copied');
+ resetTimer.current = setTimeout(() => setCopyStatus(''), 2000);
+ } catch {
+ clearTimeout(resetTimer.current);
+ setCopyStatus('Select the command and copy it manually.');
+ }
+ }
return (
-
- {kind}
-
- x:{frame.x} y:{frame.y}
-
-
- w:{frame.width} h:{frame.height} pt
-
-
- );
-}
+
+
+
+
+ Wrap a view in ReservedRegionsProvider and read its regions with useReservedRegions. Pair region
+ frames with safe area insets when your screen needs both edge spacing and information about its
+ interior.
+
+
+ Learn more ↗
+
-
-
+
+
+ {snippet}
+
+
+
+
+ Compare full-screen, inset, and content-box providers, with safe area insets alongside reserved
+ regions.
+