### Implement Complete One-Click Login Flow Source: https://context7.com/yoonzm/react-native-ali-onepass/llms.txt This example demonstrates the full lifecycle of the OnePass SDK, including initialization, event listener setup, UI customization, and backend token verification. ```javascript import React, { Component } from 'react'; import { View, Button, Alert, Platform } from 'react-native'; import * as OnePass from 'react-native-ali-onepass'; export default class LoginScreen extends Component { listeners = []; async componentDidMount() { await this.initializeOnePass(); this.setupEventListeners(); } componentWillUnmount() { this.listeners.forEach(l => l.remove()); } async initializeOnePass() { try { const key = Platform.OS === 'ios' ? IOS_KEY : ANDROID_KEY; await OnePass.init(key); const available = await OnePass.checkEnvAvailable(); if (available) { await OnePass.prefetch(); this.setState({ onePassReady: true }); } } catch (error) { console.error('OnePass init failed:', error); } } setupEventListeners() { this.listeners.push( OnePass.addListener(OnePass.EVENTS.onTokenSuccess, async (data) => { if (Number(data.code) === 600000) { try { // Verify token with your backend const response = await fetch('https://api.yourserver.com/verify', { method: 'POST', body: JSON.stringify({ token: data.token }), }); const { phoneNumber } = await response.json(); await OnePass.hideLoginLoading(); await OnePass.quitLoginPage(); // Login successful - proceed with phone number this.props.onLoginSuccess(phoneNumber); } catch (error) { await OnePass.hideLoginLoading(); Alert.alert('Error', 'Server verification failed'); } } else if (Number(data.code) === 700001) { await OnePass.quitLoginPage(); this.props.onSwitchToSMS(); } }), OnePass.addListener(OnePass.EVENTS.onTokenFailed, (data) => { Alert.alert('Login Failed', data.msg); }) ); } handleOnePassLogin = async () => { const operatorType = await OnePass.getOperatorType(); await OnePass.setUIConfig({ navText: 'Quick Login', logoImgPath: 'app_logo', sloganText: `${operatorType} authentication`, logBtnText: 'One-click Login', switchAccText: 'Use SMS instead', privacyState: true, appPrivacyOneName: '《Terms》', appPrivacyOneUrl: 'https://example.com/terms', }); await OnePass.onePass(); }; render() { return (