-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IOPLT-161] Code refinement for
HeaderFirstLevel
component (#93)
## Short description This PR refines the code for `HeaderFirstLevel` component ## List of changes proposed in this pull request - Applies the same logic of the header second level to handle the three actions ## How to test Check the example app https://github.com/pagopa/io-app-design-system/assets/3959405/e61dd346-862c-4e12-9a48-99f40b73dee3
- Loading branch information
1 parent
962aba4
commit 1db5437
Showing
8 changed files
with
146 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import * as React from "react"; | ||
import { Alert, ScrollView } from "react-native"; | ||
import { useSafeAreaInsets } from "react-native-safe-area-context"; | ||
import { useNavigation } from "@react-navigation/native"; | ||
import { | ||
Body, | ||
ButtonSolid, | ||
H3, | ||
HeaderFirstLevel, | ||
IOVisualCostants, | ||
VSpacer | ||
} from "@pagopa/io-app-design-system"; | ||
|
||
export const HeaderFirstLevelScreen = () => { | ||
const insets = useSafeAreaInsets(); | ||
const navigation = useNavigation(); | ||
|
||
React.useLayoutEffect(() => { | ||
navigation.setOptions({ | ||
header: () => ( | ||
<HeaderFirstLevel | ||
title={"Pagina"} | ||
type="singleAction" | ||
firstAction={{ | ||
icon: "help", | ||
onPress: () => { | ||
Alert.alert("Contextual Help"); | ||
}, | ||
accessibilityLabel: "" | ||
}} | ||
/> | ||
) | ||
}); | ||
}, [navigation]); | ||
|
||
return ( | ||
<ScrollView | ||
contentContainerStyle={{ | ||
paddingBottom: insets.bottom, | ||
paddingHorizontal: IOVisualCostants.appMarginDefault | ||
}} | ||
scrollEventThrottle={8} | ||
snapToEnd={false} | ||
decelerationRate="normal" | ||
> | ||
<H3>Questo è un titolo lungo, ma lungo lungo davvero, eh!</H3> | ||
<VSpacer /> | ||
<ButtonSolid | ||
label="Torna indietro" | ||
onPress={navigation.goBack} | ||
accessibilityLabel="" | ||
/> | ||
<VSpacer /> | ||
{[...Array(50)].map((_el, i) => ( | ||
<Body key={`body-${i}`}>Repeated text</Body> | ||
))} | ||
</ScrollView> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from "react"; | ||
import { IconButton } from "../buttons"; | ||
|
||
export type ActionProp = Pick< | ||
React.ComponentProps<typeof IconButton>, | ||
"icon" | "onPress" | "accessibilityLabel" | "accessibilityHint" | "testID" | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters