Skip to content

Commit

Permalink
fix: behavior of pressing on GasAccount login popup.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardo2016x committed Nov 29, 2024
1 parent a0abfdf commit 485fbe7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/mobile/src/components/AccountSelector/AccountsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ function AddressItemInSheetModal({
isCurrent,
isPinned,
showCopyAndQR,
defaultPressAction = showCopyAndQR ? 'copy' : 'asPress',
onPressAccount: proponPressAddress,
}: {
addressItemProps: AddressItemProps & { account: Account };
isCurrent?: boolean;
isPinned?: boolean;
showCopyAndQR?: boolean;
defaultPressAction?: 'copy' | 'asPress';
onPressAccount?: (account: Account) => void;
} & RNViewProps) {
const { styles, colors2024 } = useTheme2024({
Expand Down Expand Up @@ -101,7 +103,9 @@ function AddressItemInSheetModal({
activeOpacity={1}
onPressIn={() => setIsPressing(true)}
onPressOut={() => setIsPressing(false)}
onPress={handleCopyAddress}>
onPress={
defaultPressAction === 'copy' ? handleCopyAddress : onPressAccount
}>
<AddressItem {...addressItemProps}>
{({ WalletIcon, WalletAddress, WalletBalance, WalletName }) => {
return (
Expand Down Expand Up @@ -312,10 +316,14 @@ export function AccountsPanelInSheetModal({
containerStyle,
onSelectAccount,
scene,
defaultPressItemAction = 'asPress',
}: {
containerStyle?: StyleProp<ViewStyle>;
onSelectAccount?: (account: Account | null) => void;
scene?: 'GasAccount' | undefined;
defaultPressItemAction?: React.ComponentProps<
typeof AddressItemInSheetModal
>['defaultPressAction'];
}) {
const { styles } = useTheme2024({ getStyle: getPanelStyle });

Expand Down Expand Up @@ -458,6 +466,7 @@ export function AccountsPanelInSheetModal({
isPinned={isPinnedAccount(item)}
onPressAccount={onSelectAccount}
showCopyAndQR={!isGasAccount}
defaultPressAction={defaultPressItemAction}
style={[index > 0 && styles.addressItemTopGap]}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/components2024/SelectAccountThen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const SelectAccountThen: React.FC<SelectAccountThenProps> = ({
<AccountsPanelInSheetModal
containerStyle={styles.accountRoot}
onSelectAccount={onDone}
defaultPressItemAction="copy"
/>
</View>
</AutoLockView>
Expand Down

0 comments on commit 485fbe7

Please sign in to comment.