Skip to content

Commit

Permalink
Merge branch 'master' into IOCOM-1370-serviceLinkClick
Browse files Browse the repository at this point in the history
  • Loading branch information
Vangaorth committed May 17, 2024
2 parents 0027e3c + 55fa198 commit 5d15842
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 365 deletions.
1 change: 1 addition & 0 deletions ts/components/DebugInfoOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const debugItemBorderColor = hexToRgba(IOColors.black, 0.1);
const styles = StyleSheet.create({
versionContainer: {
...StyleSheet.absoluteFillObject,
top: -8,
justifyContent: "flex-start",
alignItems: "center",
zIndex: 1000
Expand Down
69 changes: 25 additions & 44 deletions ts/components/ui/AlertModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react";
import {
BackHandler,
NativeEventSubscription,
StyleSheet,
View
} from "react-native";
import { IOColors, hexToRgba } from "@pagopa/io-app-design-system";
IOColors,
IOVisualCostants,
hexToRgba
} from "@pagopa/io-app-design-system";
import React from "react";
import { StyleSheet, View } from "react-native";
import { useHardwareBackButton } from "../../hooks/useHardwareBackButton";
import themeVariables from "../../theme/variables";
import { Body } from "../core/typography/Body";
import { Overlay } from "./Overlay";
Expand All @@ -21,49 +21,30 @@ const styles = StyleSheet.create({
width: "auto",
backgroundColor: IOColors.white,
padding: themeVariables.contentPadding,
borderRadius: 8
marginHorizontal: IOVisualCostants.appMarginDefault,
borderCurve: "continuous",
borderRadius: 16
}
});

type Props = Readonly<{
type AlertModalProps = Readonly<{
message: string;
}>;

/**
* A custom alert to show a message
*/
export class AlertModal extends React.PureComponent<Props> {
private subscription: NativeEventSubscription | undefined;
constructor(props: Props) {
super(props);
}

public componentDidMount() {
// eslint-disable-next-line functional/immutable-data
this.subscription = BackHandler.addEventListener(
"hardwareBackPress",
this.onBackPressed
);
}

public componentWillUnmount() {
this.subscription?.remove();
}

private onBackPressed() {
return true;
}

public render() {
return (
<Overlay
backgroundColor={opaqueBgColor}
foreground={
<View style={styles.container}>
<Body color="bluegreyDark">{this.props.message}</Body>
</View>
}
/>
);
}
}
export const AlertModal = ({ message }: AlertModalProps) => {
useHardwareBackButton(() => true);

return (
<Overlay
backgroundColor={opaqueBgColor}
foreground={
<View style={styles.container}>
<Body color="bluegreyDark">{message}</Body>
</View>
}
/>
);
};
2 changes: 0 additions & 2 deletions ts/features/design-system/components/DesignSystemScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ScrollView, StatusBar, View, useColorScheme } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import {
ContentWrapper,
IOColors,
IOVisualCostants,
useIOTheme
} from "@pagopa/io-app-design-system";
Expand All @@ -27,7 +26,6 @@ export const DesignSystemScreen = ({ children, noMargin = false }: Props) => {
/>
<ScrollView
contentContainerStyle={{
backgroundColor: IOColors[theme["appBackground-primary"]],
paddingTop: IOVisualCostants.appMarginDefault,
paddingBottom: insets.bottom + IOVisualCostants.appMarginDefault
}}
Expand Down
Loading

0 comments on commit 5d15842

Please sign in to comment.