From 37d275c380b4e5d3caa9a6266ce03f8e35f19ecc Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Fri, 25 Oct 2024 22:07:46 +0100 Subject: [PATCH] feat: add buttons to hide/show ui --- packages/react-native-ui/src/Layout.tsx | 32 +++++++++++++++++-- .../src/icon/CloseFullscreenIcon.tsx | 19 +++++++++++ .../src/icon/FullscreenIcon.tsx | 21 ++++++++++++ 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 packages/react-native-ui/src/icon/CloseFullscreenIcon.tsx create mode 100644 packages/react-native-ui/src/icon/FullscreenIcon.tsx diff --git a/packages/react-native-ui/src/Layout.tsx b/packages/react-native-ui/src/Layout.tsx index 8bcfd8deba..b3f2a56ec6 100644 --- a/packages/react-native-ui/src/Layout.tsx +++ b/packages/react-native-ui/src/Layout.tsx @@ -4,7 +4,7 @@ import { type API_IndexHash, type Args, type StoryContext } from '@storybook/cor import type { ReactRenderer } from '@storybook/react'; import { styled, useTheme } from '@storybook/react-native-theming'; import { ReactNode, useRef, useState } from 'react'; -import { Platform, ScrollView, Text, View } from 'react-native'; +import { Platform, ScrollView, Text, TouchableOpacity, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { IconButton } from './IconButton'; import { useLayout } from './LayoutProvider'; @@ -16,6 +16,8 @@ import { BottomBarToggleIcon } from './icon/BottomBarToggleIcon'; import { DarkLogo } from './icon/DarkLogo'; import { Logo } from './icon/Logo'; import { MenuIcon } from './icon/MenuIcon'; +import { FullscreenIcon } from './icon/FullscreenIcon'; +import { CloseFullscreenIcon } from './icon/CloseFullscreenIcon'; export const Layout = ({ storyHash, @@ -38,6 +40,8 @@ export const Layout = ({ const [desktopAddonsPanelOpen, setDesktopAddonsPanelOpen] = useState(true); + const [uiHidden, setUiHidden] = useState(false); + if (isDesktop) { return ( - {children} + + {children} + + setUiHidden(!uiHidden)} + > + {uiHidden ? ( + + ) : ( + + )} + + @@ -161,7 +187,7 @@ export const Layout = ({ - {(Platform.OS !== 'android' || (!menuOpen && !drawerOpen)) && ( + {!uiHidden && (Platform.OS !== 'android' || (!menuOpen && !drawerOpen)) && (