diff --git a/BlueComponents.js b/BlueComponents.js
index 465f3bf58..476b27ecd 100644
--- a/BlueComponents.js
+++ b/BlueComponents.js
@@ -5,7 +5,6 @@ import { Icon, Text, Header } from 'react-native-elements';
import {
ActivityIndicator,
Dimensions,
- Image,
InputAccessoryView,
Keyboard,
KeyboardAvoidingView,
@@ -33,140 +32,6 @@ if (aspectRatio > 1.6) {
isIpad = true;
}
-export const BitcoinButton = props => {
- const { colors } = useTheme();
- return (
-
-
-
-
-
-
-
-
- {loc.wallets.add_bitcoin}
-
-
- {loc.wallets.add_bitcoin_explain}
-
-
-
-
-
- );
-};
-
-export const VaultButton = props => {
- const { colors } = useTheme();
- return (
-
-
-
-
-
-
-
-
- {loc.multisig.multisig_vault}
-
-
- {loc.multisig.multisig_vault_explain}
-
-
-
-
-
- );
-};
-
-export const LightningButton = props => {
- const { colors } = useTheme();
- return (
-
-
-
-
-
-
-
-
- {loc.wallets.add_lightning}
-
-
- {loc.wallets.add_lightning_explain}
-
-
-
-
-
- );
-};
-
/**
* TODO: remove this comment once this file gets properly converted to typescript.
*
diff --git a/components/WalletButton.tsx b/components/WalletButton.tsx
new file mode 100644
index 000000000..a299513d3
--- /dev/null
+++ b/components/WalletButton.tsx
@@ -0,0 +1,115 @@
+import React from 'react';
+import { TouchableOpacity, View, Text, Image, I18nManager, StyleSheet, ImageSourcePropType, DimensionValue } from 'react-native';
+import { Theme, useTheme } from './themes';
+import loc from '../loc';
+
+interface ButtonDetails {
+ image: ImageSourcePropType;
+ title: string;
+ explain: string;
+ borderColorActive: keyof Theme['colors'];
+}
+
+interface WalletButtonProps {
+ buttonType: keyof typeof buttonDetails;
+ testID?: string;
+ onPress: () => void;
+ size: {
+ width: DimensionValue | undefined;
+ height: DimensionValue | undefined;
+ };
+ active: boolean;
+}
+
+const buttonDetails: Record = {
+ Bitcoin: {
+ image: require('../img/addWallet/bitcoin.png'),
+ title: loc.wallets.add_bitcoin,
+ explain: loc.wallets.add_bitcoin_explain,
+ borderColorActive: 'newBlue',
+ },
+ Vault: {
+ image: require('../img/addWallet/vault.png'),
+ title: loc.multisig.multisig_vault,
+ explain: loc.multisig.multisig_vault_explain,
+ borderColorActive: 'foregroundColor',
+ },
+ Lightning: {
+ image: require('../img/addWallet/lightning.png'),
+ title: loc.wallets.add_lightning,
+ explain: loc.wallets.add_lightning_explain,
+ borderColorActive: 'lnborderColor',
+ },
+};
+
+const WalletButton: React.FC = ({ buttonType, testID, onPress, size, active }) => {
+ const details = buttonDetails[buttonType];
+ const { colors } = useTheme();
+ const borderColor = active ? colors[details.borderColorActive] : colors.buttonDisabledBackgroundColor;
+ const dynamicStyles = StyleSheet.create({
+ buttonContainer: {
+ borderColor,
+ backgroundColor: colors.buttonDisabledBackgroundColor,
+ minWidth: size.width,
+ minHeight: size.height,
+ height: size.height,
+ },
+ textTitle: {
+ color: colors[details.borderColorActive],
+ },
+ textExplain: {
+ color: colors.alternativeTextColor,
+ },
+ });
+
+ return (
+
+
+
+
+
+ {details.title}
+ {details.explain}
+
+
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ touchable: {
+ flex: 1,
+ marginBottom: 8,
+ },
+ container: {
+ borderWidth: 1.5,
+ borderRadius: 8,
+ },
+ content: {
+ marginHorizontal: 16,
+ marginVertical: 10,
+ flexDirection: 'row',
+ alignItems: 'center',
+ },
+ image: {
+ width: 34,
+ height: 34,
+ marginRight: 8,
+ },
+ textContainer: {
+ flex: 1,
+ },
+ textTitle: {
+ fontWeight: 'bold',
+ fontSize: 18,
+ writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
+ },
+ textExplain: {
+ fontSize: 13,
+ fontWeight: '500',
+ writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
+ },
+});
+
+export default WalletButton;
diff --git a/screen/wallets/add.tsx b/screen/wallets/add.tsx
index 913709195..29c2fd795 100644
--- a/screen/wallets/add.tsx
+++ b/screen/wallets/add.tsx
@@ -5,6 +5,7 @@ import {
ActivityIndicator,
Keyboard,
KeyboardAvoidingView,
+ LayoutAnimation,
Platform,
ScrollView,
StyleSheet,
@@ -14,16 +15,7 @@ import {
useColorScheme,
} from 'react-native';
-import {
- BitcoinButton,
- BlueButtonLink,
- BlueFormLabel,
- BlueSpacing20,
- BlueSpacing40,
- BlueText,
- LightningButton,
- VaultButton,
-} from '../../BlueComponents';
+import { BlueButtonLink, BlueFormLabel, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { HDSegwitBech32Wallet, HDSegwitP2SHWallet, LightningCustodianWallet, LightningLdkWallet, SegwitP2SHWallet } from '../../class';
@@ -36,6 +28,7 @@ import useAsyncPromise from '../../hooks/useAsyncPromise';
import loc from '../../loc';
import { Chain } from '../../models/bitcoinUnits';
import { AppStorage } from '../../BlueApp';
+import WalletButton from '../../components/WalletButton';
import A from '../../blue_modules/analytics';
enum ButtonSelected {
@@ -345,16 +338,19 @@ const WalletsAdd: React.FC = () => {
};
const handleOnVaultButtonPressed = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
Keyboard.dismiss();
setSelectedWalletType(ButtonSelected.VAULT);
};
const handleOnBitcoinButtonPressed = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
Keyboard.dismiss();
setSelectedWalletType(ButtonSelected.ONCHAIN);
};
const handleOnLightningButtonPressed = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
// @ts-ignore: Return later to update
setBackdoorPressed((prevState: number) => {
return prevState + 1;
@@ -364,6 +360,7 @@ const WalletsAdd: React.FC = () => {
};
const handleOnLdkButtonPressed = async () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
Keyboard.dismiss();
setSelectedWalletType(ButtonSelected.LDK);
};
@@ -387,16 +384,18 @@ const WalletsAdd: React.FC = () => {
{loc.wallets.add_wallet_type}
-
-
{backdoorPressed > 10 ? (
{
text="LDK"
/>
) : null}
-