You can listen to various events in the WalletBalance
using the onEvent
prop.
import { WalletBalance } from '@card91/react-native-sdk';
export function Page() {
const onWalletEvent = (event) => {
switch (event) {
case 'C91_WALLET_SCREEN_INITIALISED':
// Do something to indicate that the wallet screen has been initialized
break;
case 'c91_WALLET_SCREEN_SUCCESS':
// Do something to handle the success of a wallet API call
break;
case 'C91_WALLET_API_FAILURE':
// Do something to handle the failure of a wallet API call
break;
case 'C91_WALLET_AUTHENTICATION_FAILURE':
// Do something to handle authentication failure in the wallet
break;
case 'C91_WALLET_SERVER_FAILURE':
// Do something to handle server failure in the wallet
break;
case 'C91_WALLET_MISSING_PARAMETER':
// Do something to handle missing parameter in the wallet
break;
default:
// Handle any other event that is not explicitly listed
break;
}
};
return (
<View>
<WalletBalance ... onEvent={onWalletEvent} />
</View>
);
}
The events are as follows:
Event Name | Description |
---|---|
C91_WALLET_SET_PARAMS | Indicates setting parameters in the wallet. |
C91_WALLET_SCREEN_INITIALISED | Denotes the initialization of the wallet screen. |
c91_WALLET_SCREEN_SUCCESS | Represents a successful response from a wallet API. |
C91_WALLET_API_FAILURE | Indicates a failure in a wallet-related API call. |
C91_WALLET_AUTHENTICATION_FAILURE | Signifies an authentication failure in the wallet. |
C91_WALLET_SERVER_FAILURE | Indicates a failure related to the wallet's server. |
C91_WALLET_MISSING_PARAMETER | Represents a scenario where a wallet parameter is missing. |