Components
Connect
A drop-in wallet connection component that handles the entire authentication flow. When disconnected, it displays a "Connect Wallet" button. When connected, it shows the user's address and opens a Profile modal on press.
Props:
onConnect?: () => void– Callback triggered after successful authenticationonDisconnect?: () => void– Callback triggered after logoutbalanceType?: "cadence" | "evm" | "combined"– Specifies which balance to display (default:"cadence")"cadence": Shows the token balance from the Cadence side"evm": Shows the token balance from the Flow EVM side"combined": Shows the total combined token balance from both sides
balanceTokens?: TokenConfig[]– Optional array of token configurations to display in the balance selectormodalEnabled?: boolean– Whether to show the profile modal on press when connected (default:true)
Basic Usage:
The simplest way to add wallet connection to your app:
_12import { View, Text } from "react-native";_12import { Connect } from "@onflow/react-native-sdk";_12_12function WalletSection() {_12 return (_12 <View>_12 <Text>Connect Wallet</Text>_12 <Text>Connect your Flow wallet to interact with the blockchain.</Text>_12 <Connect />_12 </View>_12 );_12}
With Callbacks:
_10import { Connect } from "@onflow/react-native-sdk";_10_10<Connect_10 onConnect={() => console.log("Wallet connected!")}_10 onDisconnect={() => console.log("Wallet disconnected")}_10/>
With Balance Display:
_12import { Connect } from "@onflow/react-native-sdk";_12_12<Connect_12 balanceType="combined"_12 balanceTokens={[_12 {_12 symbol: "FLOW",_12 name: "Flow",_12 vaultIdentifier: "A.1654653399040a61.FlowToken.Vault",_12 },_12 ]}_12/>
Profile
A standalone component for displaying wallet information including account address and balance. Use this when you want to show user details separately from the Connect button.
Props:
onDisconnect?: () => void– Callback triggered when the user presses the disconnect buttonbalanceType?: "cadence" | "evm" | "combined"– Specifies which balance to display (default:"cadence")"cadence": Shows the token balance from the Cadence side"evm": Shows the token balance from the Flow EVM side"combined": Shows the total combined token balance from both sides
balanceTokens?: TokenConfig[]– Optional array of token configurations to display in the balance selector
Usage:
_19import { View } from "react-native";_19import { Profile, useFlowCurrentUser } from "@onflow/react-native-sdk";_19_19function UserProfile() {_19 const { user } = useFlowCurrentUser();_19_19 if (!user?.loggedIn) {_19 return null;_19 }_19_19 return (_19 <View>_19 <Profile_19 balanceType="combined"_19 onDisconnect={() => console.log("User disconnected")}_19 />_19 </View>_19 );_19}