Skip to content

Commit a853401

Browse files
soixdev91Ladirico
andauthored
chore: [IEL-54] Adjusted pdf vertical positioning (#7861)
## Short description Adjusts FCI PDF/document layouts to account for footer safe-area measurements so content positioning remains correct above footer actions. ## List of changes proposed in this pull request - Measure footer actions/safe-area and apply bottom margins in `DocumentWithSignature` and `FciDocumentsScreen` - for `DocumentWithSignature` there's spacing added above the footer button [extraFooterActionsMargin](https://github.com/pagopa/io-app/pull/7861/changes#diff-22a00a9883d0bdf296564791d8745fc2354d0cf4f0e42fe1a3dc85e9211bc988R66) in order to match the look of `FciDocumentsScreen` ## How to test Start from MESSAGE_DETAIL for a signature request in state WAIT_FOR_SIGNATURE, then access from the message a document to sign (`FciDocumentsScreen`) and the same document with signature preview (`DocumentWithSignature`) <table><tr><th>Before</th><th>After</th></tr><tr><td> <img width="617" height="1319" alt="image" src="https://github.com/user-attachments/assets/7a3b8afe-696b-4f89-902a-99fd510861f0" /> </td><td> <img width="617" height="1320" alt="image" src="https://github.com/user-attachments/assets/eb717078-e728-42a9-b8eb-2c4dee2cd4d3" /> </td></tr><tr><td> <img width="615" height="1318" alt="image" src="https://github.com/user-attachments/assets/0ed8ead0-7b20-4a96-a60b-d16eac50dd20" /> </td><td> <img width="616" height="1318" alt="image" src="https://github.com/user-attachments/assets/2411c3e9-533e-474f-9201-3d81bae4d8e4" /> </td></tr></table> --------- Co-authored-by: Alice Di Rico <83651704+Ladirico@users.noreply.github.com>
1 parent d0624cd commit a853401

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

ts/features/fci/components/DocumentWithSignature.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {
55
HSpacer,
66
IconButton,
77
IOColors,
8+
IOSpacing,
9+
IOSpacingScale,
10+
useFooterActionsMeasurements,
811
useIOTheme,
912
VSpacer
1013
} from "@pagopa/io-app-design-system";
@@ -13,7 +16,7 @@ import { constNull, pipe } from "fp-ts/lib/function";
1316
import * as O from "fp-ts/lib/Option";
1417
import I18n from "i18next";
1518
import { useCallback, useRef, useState } from "react";
16-
import { StyleSheet } from "react-native";
19+
import { StyleSheet, View } from "react-native";
1720
import Pdf, { PdfRef } from "react-native-pdf";
1821
import { SafeAreaView } from "react-native-safe-area-context";
1922
import { ExistingSignatureFieldAttrs } from "../../../../definitions/fci/ExistingSignatureFieldAttrs";
@@ -60,8 +63,13 @@ const DocumentWithSignature = (props: Props) => {
6063
const dispatch = useIODispatch();
6164
const onContinuePress = () => props.onClose();
6265

66+
const extraFooterActionsMargin: IOSpacingScale = 16;
67+
6368
const theme = useIOTheme();
6469

70+
const { footerActionsMeasurements, handleFooterActionsMeasurements } =
71+
useFooterActionsMeasurements();
72+
6573
const continueButtonProps: ButtonBlockProps = {
6674
onPress: onContinuePress,
6775
label: I18n.t("features.fci.documents.footer.backToSignFieldsList")
@@ -225,8 +233,19 @@ const DocumentWithSignature = (props: Props) => {
225233
disabled={false}
226234
testID={"FciDocumentsNavBarTestID"}
227235
/>
228-
<RenderMask />
236+
<View
237+
style={{
238+
flex: 1,
239+
marginBottom:
240+
footerActionsMeasurements.safeBottomAreaHeight -
241+
IOSpacing.screenEndMargin +
242+
extraFooterActionsMargin
243+
}}
244+
>
245+
<RenderMask />
246+
</View>
229247
<FooterActions
248+
onMeasure={handleFooterActionsMeasurements}
230249
actions={{
231250
type: "SingleButton",
232251
primary: continueButtonProps

ts/features/fci/screens/valid/FciDocumentsScreen.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { FooterActionsInline, IOColors } from "@pagopa/io-app-design-system";
1+
import {
2+
FooterActionsInline,
3+
IOColors,
4+
IOSpacing,
5+
useFooterActionsInlineMeasurements
6+
} from "@pagopa/io-app-design-system";
27
import {
38
RouteProp,
49
StackActions,
@@ -69,6 +74,11 @@ const FciDocumentsScreen = () => {
6974
const isFocused = useIsFocused();
7075
const [focusEpoch, setFocusEpoch] = useState(0);
7176

77+
const {
78+
footerActionsInlineMeasurements,
79+
handleFooterActionsInlineMeasurements
80+
} = useFooterActionsInlineMeasurements();
81+
7282
useEffect(() => {
7383
if (documents.length !== 0 && isFocused) {
7484
dispatch(fciDownloadPreview.request({ url: documents[currentDoc].url }));
@@ -272,8 +282,18 @@ const FciDocumentsScreen = () => {
272282
<View style={{ flex: 1 }} testID={"FciDocumentsScreenTestID"}>
273283
{documents.length > 0 && (
274284
<>
275-
{renderPager()}
285+
<View
286+
style={{
287+
flex: 1,
288+
marginBottom:
289+
footerActionsInlineMeasurements.safeBottomAreaHeight -
290+
IOSpacing.screenEndMargin
291+
}}
292+
>
293+
{renderPager()}
294+
</View>
276295
<FooterActionsInline
296+
onMeasure={handleFooterActionsInlineMeasurements}
277297
startAction={cancelButtonProps}
278298
endAction={endActionButtonProps}
279299
/>

0 commit comments

Comments
 (0)