import React from 'react';
import {
TouchableOpacity,
Text,
ActivityIndicator,
StyleSheet,
View,
} from 'react-native';
import { useAuth } from '../hooks/useAuth';
import { useDubsTheme } from './theme';
export interface ConnectWalletButtonProps {
/** Button label. Defaults to "Connect Wallet" */
label?: string;
/** Override accent/background color */
accentColor?: string;
/** Override text color. Defaults to #000 */
textColor?: string;
/** Override border radius */
borderRadius?: number;
/** Override padding vertical */
paddingVertical?: number;
/** Override font size */
fontSize?: number;
/** Full width. Defaults to true */
fullWidth?: boolean;
/** Called after authenticate() is triggered (not after it completes) */
onPress?: () => void;
}
/**
* ConnectWalletButton
*
* A minimal, customisable button that fires useAuth().authenticate().
* Use this when you want to own the connect-wallet screen UI (e.g. inside
* your own onboarding) but still hand off the wallet picker, signing, and
* registration flow to the SDK.
*
* The SDK will handle everything after this tap:
* wallet picker → sign message → (registration/avatar if new user) → authenticated
*
* Example:
*
*/
export function ConnectWalletButton({
label = 'Connect Wallet',
accentColor,
textColor = '#000000',
borderRadius = 16,
paddingVertical = 16,
fontSize = 17,
fullWidth = true,
onPress,
}: ConnectWalletButtonProps) {
const t = useDubsTheme();
const { authenticate, status } = useAuth();
const connecting = status === 'authenticating' || status === 'signing' || status === 'verifying';
const accent = accentColor || t.accent;
const handlePress = () => {
onPress?.();
authenticate();
};
return (
{connecting ? (
) : (
{label}
)}
);
}
const styles = StyleSheet.create({
btn: {
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: 24,
},
label: {
fontWeight: '800',
letterSpacing: -0.2,
},
});