-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IOPID-2162-remove-cieid-ff
- Loading branch information
Showing
37 changed files
with
2,344 additions
and
1,421 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
168 changes: 0 additions & 168 deletions
168
ts/features/itwallet/common/components/ItwCredentialCard.tsx
This file was deleted.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
ts/features/itwallet/common/components/ItwCredentialCard/CardBackground.tsx
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,90 @@ | ||
import { IOColors } from "@pagopa/io-app-design-system"; | ||
import { | ||
BlendColor, | ||
Canvas, | ||
Image, | ||
useImage | ||
} from "@shopify/react-native-skia"; | ||
import { useEffect, useState } from "react"; | ||
import { StyleSheet, View } from "react-native"; | ||
import Animated, { | ||
Easing, | ||
useAnimatedStyle, | ||
useSharedValue, | ||
withTiming | ||
} from "react-native-reanimated"; | ||
import { CredentialType } from "../../utils/itwMocksUtils"; | ||
import { CardColorScheme } from "./types"; | ||
|
||
type ItwCredentialCardBackgroundProps = { | ||
credentialType: string; | ||
colorScheme: CardColorScheme; | ||
}; | ||
|
||
export const CardBackground = ({ | ||
credentialType, | ||
colorScheme | ||
}: ItwCredentialCardBackgroundProps) => { | ||
const [size, setSize] = useState({ width: 0, height: 0 }); | ||
const image = useImage(credentialCardBackgrounds[credentialType]); | ||
const loadingOverlayOpacity = useSharedValue(1); | ||
|
||
const loadingOverlayOpacityTransition = useAnimatedStyle(() => ({ | ||
opacity: withTiming(loadingOverlayOpacity.value, { | ||
duration: 200, | ||
easing: Easing.ease | ||
}) | ||
})); | ||
|
||
useEffect(() => { | ||
// Set loading ended only if we have an image and a size defined | ||
if (image && size.width > 0 && size.height > 0) { | ||
// eslint-disable-next-line functional/immutable-data | ||
loadingOverlayOpacity.value = 0; | ||
} | ||
}, [image, loadingOverlayOpacity, size]); | ||
|
||
return ( | ||
<View | ||
style={[ | ||
StyleSheet.absoluteFillObject, | ||
{ backgroundColor: IOColors.white } | ||
]} | ||
onLayout={event => { | ||
setSize({ | ||
width: event.nativeEvent.layout.width, | ||
height: event.nativeEvent.layout.height | ||
}); | ||
}} | ||
> | ||
<Canvas style={{ flex: 1 }}> | ||
<Image | ||
image={image} | ||
fit="fill" | ||
width={size.width} | ||
height={size.height} | ||
opacity={colorScheme === "default" ? 1 : 0.4} | ||
> | ||
{colorScheme === "greyscale" && ( | ||
<BlendColor color="white" mode="color" /> | ||
)} | ||
</Image> | ||
</Canvas> | ||
<Animated.View | ||
style={[ | ||
loadingOverlayOpacityTransition, | ||
StyleSheet.absoluteFillObject, | ||
{ backgroundColor: IOColors["grey-100"] } | ||
]} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const credentialCardBackgrounds: { | ||
[type: string]: string; | ||
} = { | ||
[CredentialType.EUROPEAN_DISABILITY_CARD]: require("../../../../../../img/features/itWallet/cards/dc.png"), | ||
[CredentialType.EUROPEAN_HEALTH_INSURANCE_CARD]: require("../../../../../../img/features/itWallet/cards/ts.png"), | ||
[CredentialType.DRIVING_LICENSE]: require("../../../../../../img/features/itWallet/cards/mdl.png") | ||
}; |
Oops, something went wrong.