Skip to content

Commit

Permalink
fix: background color check (#104)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan <[email protected]>
  • Loading branch information
Jan authored Apr 16, 2024
1 parent aeb14e3 commit 6ab30c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/expo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo-app",
"version": "1.3.3",
"version": "1.3.4",
"main": "expo-router/entry",
"private": true,
"scripts": {
Expand Down
15 changes: 10 additions & 5 deletions packages/app/components/CredentialCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ export default function CredentialCard({
</XStack>
)

const getPressStyle = () => {
if (!onPress) return {}
if (backgroundImage?.url) return { opacity: 0.9 }
return { backgroundColor: darken(bgColor ?? '$grey-900', 0.1) }
}

const bgColorValue = backgroundImage?.url ? '$transparent' : bgColor ?? '$grey-900'

return (
<XStack
shadow={shadow}
br="$8"
bg={!backgroundImage ? bgColor ?? '$grey-900' : '$transparent'}
bg={bgColorValue}
borderWidth={0.5}
borderColor="$borderTranslucent"
position="relative"
Expand All @@ -63,10 +71,7 @@ export default function CredentialCard({
padded
width="100%"
br="$8"
bg={!backgroundImage ? bgColor ?? '$grey-900' : '$transparent'}
pressStyle={{
backgroundColor: onPress && darken(bgColor ?? '$grey-900', 0.05),
}}
pressStyle={getPressStyle()}
h="$16"
onPress={onPress}
overflow="hidden"
Expand Down

0 comments on commit 6ab30c1

Please sign in to comment.