add pressed state and rm cloneElement

zio/stable
Samuel Newman 2024-03-19 22:06:59 +00:00
parent 1f02ed5d87
commit 49cd7e4bcf
1 changed files with 5 additions and 11 deletions

View File

@ -35,13 +35,7 @@ function Group({children}: {children: React.ReactNode}) {
{i > 0 ? ( {i > 0 ? (
<View style={[a.border_b, t.atoms.border_contrast_low]} /> <View style={[a.border_b, t.atoms.border_contrast_low]} />
) : null} ) : null}
{React.cloneElement(child, { {child}
// @ts-ignore
style: {
borderRadius: 0,
borderWidth: 0,
},
})}
</React.Fragment> </React.Fragment>
) : null ) : null
})} })}
@ -77,14 +71,14 @@ function AccountItem({
? _(msg`Continue as ${account.handle} (currently signed in)`) ? _(msg`Continue as ${account.handle} (currently signed in)`)
: _(msg`Sign in as ${account.handle}`) : _(msg`Sign in as ${account.handle}`)
}> }>
{({hovered}) => ( {({hovered, pressed}) => (
<View <View
style={[ style={[
a.flex_1, a.flex_1,
a.flex_row, a.flex_row,
a.align_center, a.align_center,
{height: 48}, {height: 48},
hovered && t.atoms.bg_contrast_25, (hovered || pressed) && t.atoms.bg_contrast_25,
]}> ]}>
<View style={a.p_md}> <View style={a.p_md}>
<UserAvatar avatar={profile?.avatar} size={24} /> <UserAvatar avatar={profile?.avatar} size={24} />
@ -165,7 +159,7 @@ export const ChooseAccountForm = ({
style={[a.flex_1]} style={[a.flex_1]}
onPress={() => onSelectAccount(undefined)} onPress={() => onSelectAccount(undefined)}
label={_(msg`Login to account that is not listed`)}> label={_(msg`Login to account that is not listed`)}>
{({hovered}) => ( {({hovered, pressed}) => (
<View <View
style={[ style={[
a.flex_1, a.flex_1,
@ -173,7 +167,7 @@ export const ChooseAccountForm = ({
a.flex_row, a.flex_row,
a.align_center, a.align_center,
{height: 48}, {height: 48},
hovered && t.atoms.bg_contrast_25, (hovered || pressed) && t.atoms.bg_contrast_25,
]}> ]}>
<Text <Text
style={[ style={[