import { Muta } from '@mutalabs/react-native-muta';
import { Alert } from 'react-native';
function Onboarding() {
useEffect(() => {
const subscription = Muta.on('error', (error) => {
switch (error.type) {
case 'network_error':
Alert.alert(
'Connection Error',
'Please check your internet connection and try again.',
[
{
text: 'Retry',
onPress: () => {
// Retry the placement
Muta.displayPlacement({
placementId: 'your-placement-id',
bgColor: '#000000'
});
}
},
{
text: 'Cancel',
style: 'cancel'
}
]
);
break;
case 'placement_error':
Alert.alert(
'Error',
'Unable to load the onboarding flow. Please try again later.',
[
{
text: 'OK',
style: 'default'
}
]
);
break;
default:
console.error('Unknown error:', error);
}
});
// Show the placement
Muta.displayPlacement({
placementId: 'your-placement-id',
bgColor: '#000000'
});
return () => subscription.remove();
}, []);
return <View style={{ flex: 1 }} />;
}