Advanced Usage

For developers needing more control over the wallet integration including theme customization and custom authentication flows.

Theme Customization

Use the ThemeProvider to customize the appearance of UI components:

1import { ThemeProvider } from '@avalabs/avacloud-waas-react';
2
3function App() {
4 return (
5 <ThemeProvider darkMode={true}>
6 <YourApp />
7 </ThemeProvider>
8 );
9}

Custom Authentication Flow

You can implement a custom authentication flow using the lower-level hooks:

1import { usePostMessage } from '@avalabs/avacloud-waas-react';
2
3function CustomAuth() {
4 const { sendMessage, lastMessage } = usePostMessage();
5
6 const handleCustomLogin = () => {
7 sendMessage({
8 type: 'login',
9 payload: {
10 // Custom payload
11 }
12 });
13 };
14
15 // Handle response in useEffect
16 useEffect(() => {
17 if (lastMessage?.type === 'login_success') {
18 // Handle successful login
19 }
20 }, [lastMessage]);
21
22 return (
23 <button onClick={handleCustomLogin}>
24 Custom Login
25 </button>
26 );
27}

For any additional questions, please view our other knowledge base articles or contact a support team member via the chat button. Examples are for illustrative purposes only.

Learn More About AvaCloud | Download Case Studies | Schedule an AvaCloud Demo