diff --git a/apps/main-app/ts/components/LoadingSpinnerOverlay.tsx b/apps/main-app/ts/components/LoadingSpinnerOverlay.tsx index a14176df1cb..a02490bb30a 100644 --- a/apps/main-app/ts/components/LoadingSpinnerOverlay.tsx +++ b/apps/main-app/ts/components/LoadingSpinnerOverlay.tsx @@ -10,9 +10,23 @@ import { ReactNode } from "react"; import { StyleSheet, View } from "react-native"; import BoxedRefreshIndicator from "./ui/BoxedRefreshIndicator"; -import { Overlay } from "./ui/Overlay"; const styles = StyleSheet.create({ + container: { + flex: 1 + }, + overlay: { + position: "absolute", + top: 0, + bottom: 0, + left: 0, + right: 0, + zIndex: 1, + justifyContent: "center" + }, + content: { + zIndex: 0 + }, textCaption: { padding: 24 } @@ -39,13 +53,19 @@ const LoadingSpinnerOverlay = ({ const theme = useIOTheme(); return ( - + {isLoading && ( + } /> - ) - } - > - {children} - + + )} + {children} + ); }; diff --git a/apps/main-app/ts/components/__tests__/__snapshots__/LoadingSpinnerOverlay.test.tsx.snap b/apps/main-app/ts/components/__tests__/__snapshots__/LoadingSpinnerOverlay.test.tsx.snap index 7387c853c68..6728ea086eb 100644 --- a/apps/main-app/ts/components/__tests__/__snapshots__/LoadingSpinnerOverlay.test.tsx.snap +++ b/apps/main-app/ts/components/__tests__/__snapshots__/LoadingSpinnerOverlay.test.tsx.snap @@ -13,7 +13,6 @@ exports[`LoadingSpinnerOverlay Should match all-properties and loading snapshot style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -24,7 +23,6 @@ exports[`LoadingSpinnerOverlay Should match all-properties and loading snapshot }, { "backgroundColor": "rgba(255,255,255,0.65)", - "opacity": 1, }, ] } @@ -569,7 +567,6 @@ exports[`LoadingSpinnerOverlay Should match base loading snapshot 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -580,7 +577,6 @@ exports[`LoadingSpinnerOverlay Should match base loading snapshot 1`] = ` }, { "backgroundColor": "rgba(255,255,255,0.7)", - "opacity": 1, }, ] } diff --git a/apps/main-app/ts/components/__tests__/__snapshots__/WebviewComponent.test.tsx.snap b/apps/main-app/ts/components/__tests__/__snapshots__/WebviewComponent.test.tsx.snap index 79af45833ed..2affa70ea46 100644 --- a/apps/main-app/ts/components/__tests__/__snapshots__/WebviewComponent.test.tsx.snap +++ b/apps/main-app/ts/components/__tests__/__snapshots__/WebviewComponent.test.tsx.snap @@ -13,7 +13,6 @@ exports[`WebviewComponent tests snapshot for component 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -24,7 +23,6 @@ exports[`WebviewComponent tests snapshot for component 1`] = ` }, { "backgroundColor": "rgba(255,255,255,0.7)", - "opacity": 1, }, ] } diff --git a/apps/main-app/ts/components/ui/Overlay.tsx b/apps/main-app/ts/components/ui/Overlay.tsx deleted file mode 100644 index d1420d7b2f5..00000000000 --- a/apps/main-app/ts/components/ui/Overlay.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { IOColors } from "@io-app/design-system"; -import { ReactNode } from "react"; -import { StyleSheet, View } from "react-native"; - -const styles = StyleSheet.create({ - container: { - flex: 1 - }, - overlay: { - position: "absolute", - top: 0, - bottom: 0, - left: 0, - right: 0, - backgroundColor: IOColors.white, - zIndex: 1, - justifyContent: "center" - }, - back: { - zIndex: 0 - } -}); - -type Props = Readonly<{ - backgroundColor?: string; - children?: ReactNode; - foreground?: ReactNode; - opacity?: number; -}>; - -/** - * Creates a full screen overlay on top of another screen. - * - * Used for loading spinners and error screens. - * - * @deprecated This component is really old and it's already used - * in many components with different tasks. We should refactor - * the existing components with a more specific component - * for each case. - */ -export const Overlay = ({ - backgroundColor = IOColors.white, - children, - foreground, - opacity = 1 -}: Props) => ( - - {foreground && ( - - {foreground} - - )} - {children} - -); diff --git a/apps/main-app/ts/components/ui/__test__/Overlay.test.tsx b/apps/main-app/ts/components/ui/__test__/Overlay.test.tsx deleted file mode 100644 index e055fff9763..00000000000 --- a/apps/main-app/ts/components/ui/__test__/Overlay.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { Overlay } from "../Overlay"; - -describe("Overlay", () => { - it("Should match base snapshot", () => { - const component = render(); - expect(component.toJSON()).toMatchSnapshot(); - }); - it("Should match all-properties snapshot", () => { - const backgroundColor = "#FF0000"; - const opacity = 0.65; - const foreground = This is a foreground; - const children = This is a child; - const component = render( - - {children} - - ); - expect(component.toJSON()).toMatchSnapshot(); - }); -}); diff --git a/apps/main-app/ts/components/ui/__test__/__snapshots__/Overlay.test.tsx.snap b/apps/main-app/ts/components/ui/__test__/__snapshots__/Overlay.test.tsx.snap deleted file mode 100644 index 2ed7db5f365..00000000000 --- a/apps/main-app/ts/components/ui/__test__/__snapshots__/Overlay.test.tsx.snap +++ /dev/null @@ -1,77 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`Overlay Should match all-properties snapshot 1`] = ` - - - - This is a foreground - - - - - This is a child - - - -`; - -exports[`Overlay Should match base snapshot 1`] = ` - - - -`; diff --git a/apps/main-app/ts/features/authentication/login/cie/components/__test__/__snapshots__/CieIdLoginWebView.test.tsx.snap b/apps/main-app/ts/features/authentication/login/cie/components/__test__/__snapshots__/CieIdLoginWebView.test.tsx.snap index 889949d3cc1..49c85c2ca2b 100644 --- a/apps/main-app/ts/features/authentication/login/cie/components/__test__/__snapshots__/CieIdLoginWebView.test.tsx.snap +++ b/apps/main-app/ts/features/authentication/login/cie/components/__test__/__snapshots__/CieIdLoginWebView.test.tsx.snap @@ -39,7 +39,6 @@ exports[`CieIdLoginWebView Should match the snapshot 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -50,7 +49,6 @@ exports[`CieIdLoginWebView Should match the snapshot 1`] = ` }, { "backgroundColor": "rgba(255,255,255,0.7)", - "opacity": 1, }, ] } diff --git a/apps/main-app/ts/features/authentication/login/cie/screens/__test__/__snapshots__/CieIdLoginScreen.test.tsx.snap b/apps/main-app/ts/features/authentication/login/cie/screens/__test__/__snapshots__/CieIdLoginScreen.test.tsx.snap index 78329582a30..cd097f0242a 100644 --- a/apps/main-app/ts/features/authentication/login/cie/screens/__test__/__snapshots__/CieIdLoginScreen.test.tsx.snap +++ b/apps/main-app/ts/features/authentication/login/cie/screens/__test__/__snapshots__/CieIdLoginScreen.test.tsx.snap @@ -39,7 +39,6 @@ exports[`CieIdLoginScreen Should match snapshot 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -50,7 +49,6 @@ exports[`CieIdLoginScreen Should match snapshot 1`] = ` }, { "backgroundColor": "rgba(255,255,255,0.7)", - "opacity": 1, }, ] } diff --git a/apps/main-app/ts/features/itwallet/discovery/screens/__tests__/__snapshots__/ItwIpzsPrivacyScreen.test.tsx.snap b/apps/main-app/ts/features/itwallet/discovery/screens/__tests__/__snapshots__/ItwIpzsPrivacyScreen.test.tsx.snap index dfd4396f332..487382c63f0 100644 --- a/apps/main-app/ts/features/itwallet/discovery/screens/__tests__/__snapshots__/ItwIpzsPrivacyScreen.test.tsx.snap +++ b/apps/main-app/ts/features/itwallet/discovery/screens/__tests__/__snapshots__/ItwIpzsPrivacyScreen.test.tsx.snap @@ -211,7 +211,6 @@ exports[`ItwIpzsPrivacyScreen should match the snapshot (L3 disabled) 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -222,7 +221,6 @@ exports[`ItwIpzsPrivacyScreen should match the snapshot (L3 disabled) 1`] = ` }, { "backgroundColor": "rgba(255,255,255,1)", - "opacity": 1, }, ] } @@ -1778,7 +1776,6 @@ exports[`ItwIpzsPrivacyScreen should match the snapshot (L3 enabled) 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -1789,7 +1786,6 @@ exports[`ItwIpzsPrivacyScreen should match the snapshot (L3 enabled) 1`] = ` }, { "backgroundColor": "rgba(255,255,255,1)", - "opacity": 1, }, ] } diff --git a/apps/main-app/ts/features/messages/components/MessageAttachment/__test__/__snapshots__/PdfViewer.test.tsx.snap b/apps/main-app/ts/features/messages/components/MessageAttachment/__test__/__snapshots__/PdfViewer.test.tsx.snap index a33dccd54f8..05d1ea076d8 100644 --- a/apps/main-app/ts/features/messages/components/MessageAttachment/__test__/__snapshots__/PdfViewer.test.tsx.snap +++ b/apps/main-app/ts/features/messages/components/MessageAttachment/__test__/__snapshots__/PdfViewer.test.tsx.snap @@ -13,7 +13,6 @@ exports[`PdfViewer should match the snapshot 1`] = ` style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -24,7 +23,6 @@ exports[`PdfViewer should match the snapshot 1`] = ` }, { "backgroundColor": "rgba(255,255,255,0.7)", - "opacity": 1, }, ] } diff --git a/apps/main-app/ts/features/messages/screens/__tests__/__snapshots__/MessageAttachment.test.tsx.snap b/apps/main-app/ts/features/messages/screens/__tests__/__snapshots__/MessageAttachment.test.tsx.snap index 3d852943b80..8edfa7923ec 100644 --- a/apps/main-app/ts/features/messages/screens/__tests__/__snapshots__/MessageAttachment.test.tsx.snap +++ b/apps/main-app/ts/features/messages/screens/__tests__/__snapshots__/MessageAttachment.test.tsx.snap @@ -211,7 +211,6 @@ exports[`MessageAttachment Should match the snapshot when everything went fine 1 style={ [ { - "backgroundColor": "#FFFFFF", "bottom": 0, "justifyContent": "center", "left": 0, @@ -222,7 +221,6 @@ exports[`MessageAttachment Should match the snapshot when everything went fine 1 }, { "backgroundColor": "rgba(255,255,255,0.7)", - "opacity": 1, }, ] }