From 2921f1a4038b52ee547ebe8d26deff39aee1a877 Mon Sep 17 00:00:00 2001
From: Jakub Kosmydel <104823336+kosmydel@users.noreply.github.com>
Date: Thu, 11 Jan 2024 13:29:29 +0100
Subject: [PATCH] added force full screen
---
.../ForceFullScreenView/index.native.tsx | 9 +++++++++
.../ForceFullScreenView/index.tsx | 18 ++++++++++++++++++
.../BlockingViews/ForceFullScreenView/types.ts | 7 +++++++
.../BlockingViews/FullPageNotFoundView.tsx | 9 +++++++--
.../workspace/WorkspacePageWithSections.js | 6 +++++-
src/styles/index.ts | 9 +++++++++
6 files changed, 55 insertions(+), 3 deletions(-)
create mode 100644 src/components/BlockingViews/ForceFullScreenView/index.native.tsx
create mode 100644 src/components/BlockingViews/ForceFullScreenView/index.tsx
create mode 100644 src/components/BlockingViews/ForceFullScreenView/types.ts
diff --git a/src/components/BlockingViews/ForceFullScreenView/index.native.tsx b/src/components/BlockingViews/ForceFullScreenView/index.native.tsx
new file mode 100644
index 000000000000..296e7c26a9bc
--- /dev/null
+++ b/src/components/BlockingViews/ForceFullScreenView/index.native.tsx
@@ -0,0 +1,9 @@
+import type ForceFullScreenViewProps from './types';
+
+function ForceFullScreenView({children}: ForceFullScreenViewProps) {
+ return children;
+}
+
+ForceFullScreenView.displayName = 'ForceFullScreenView';
+
+export default ForceFullScreenView;
diff --git a/src/components/BlockingViews/ForceFullScreenView/index.tsx b/src/components/BlockingViews/ForceFullScreenView/index.tsx
new file mode 100644
index 000000000000..211403fd9ca1
--- /dev/null
+++ b/src/components/BlockingViews/ForceFullScreenView/index.tsx
@@ -0,0 +1,18 @@
+import React from 'react';
+import {View} from 'react-native';
+import useThemeStyles from '@hooks/useThemeStyles';
+import type ForceFullScreenViewProps from './types';
+
+function ForceFullScreenView({children, forceFullPage = false}: ForceFullScreenViewProps) {
+ const styles = useThemeStyles();
+
+ if (forceFullPage) {
+ return {children};
+ }
+
+ return children;
+}
+
+ForceFullScreenView.displayName = 'ForceFullScreenViewProps';
+
+export default ForceFullScreenView;
diff --git a/src/components/BlockingViews/ForceFullScreenView/types.ts b/src/components/BlockingViews/ForceFullScreenView/types.ts
new file mode 100644
index 000000000000..3cdcb214cc76
--- /dev/null
+++ b/src/components/BlockingViews/ForceFullScreenView/types.ts
@@ -0,0 +1,7 @@
+import type ChildrenProps from '@src/types/utils/ChildrenProps';
+
+type ForceFullScreenViewProps = ChildrenProps & {
+ forceFullPage?: boolean;
+};
+
+export default ForceFullScreenViewProps;
diff --git a/src/components/BlockingViews/FullPageNotFoundView.tsx b/src/components/BlockingViews/FullPageNotFoundView.tsx
index 5993e60861f5..a5d313a0e14b 100644
--- a/src/components/BlockingViews/FullPageNotFoundView.tsx
+++ b/src/components/BlockingViews/FullPageNotFoundView.tsx
@@ -9,6 +9,7 @@ import variables from '@styles/variables';
import type {TranslationPaths} from '@src/languages/types';
import ROUTES from '@src/ROUTES';
import BlockingView from './BlockingView';
+import ForceFullScreenView from './ForceFullScreenView';
type FullPageNotFoundViewProps = {
/** Child elements */
@@ -37,6 +38,9 @@ type FullPageNotFoundViewProps = {
/** Function to call when pressing the navigation link */
onLinkPress: () => void;
+
+ /** Whether we should force the full page view */
+ forceFullPage?: boolean;
};
// eslint-disable-next-line rulesdir/no-negated-variables
@@ -50,13 +54,14 @@ function FullPageNotFoundView({
shouldShowLink = true,
shouldShowBackButton = true,
onLinkPress = () => Navigation.dismissModal(),
+ forceFullPage = false,
}: FullPageNotFoundViewProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
if (shouldShow) {
return (
- <>
+
- >
+
);
}
diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js
index f2154f77c9e5..b8a9443ef2de 100644
--- a/src/pages/workspace/WorkspacePageWithSections.js
+++ b/src/pages/workspace/WorkspacePageWithSections.js
@@ -119,6 +119,8 @@ function WorkspacePageWithSections({
const {isSmallScreenWidth} = useWindowDimensions();
const firstRender = useRef(true);
+ const goBack = () => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES);
+
useEffect(() => {
// Because isLoading is false before merging in Onyx, we need firstRender ref to display loading page as well before isLoading is change to true
firstRender.current = false;
@@ -137,9 +139,11 @@ function WorkspacePageWithSections({
shouldShowOfflineIndicatorInWideScreen={shouldShowOfflineIndicatorInWideScreen}
>
Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
+ onBackButtonPress={goBack}
+ onLinkPress={goBack}
shouldShow={_.isEmpty(policy) || !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy)}
subtitleKey={_.isEmpty(policy) ? undefined : 'workspace.common.notAuthorized'}
+ forceFullPage
>
paddingBottom: variables.contentHeaderHeight,
},
+ forcedBlockingViewContainer: {
+ ...positioning.pFixed,
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0,
+ backgroundColor: theme.appBG,
+ },
+
defaultModalContainer: {
backgroundColor: theme.componentBG,
borderColor: theme.transparent,