20 lines
438 B
TypeScript
20 lines
438 B
TypeScript
import { Alert as RNAlert } from 'react-native';
|
|
|
|
interface AlertButton {
|
|
text: string;
|
|
onPress?: () => void;
|
|
style?: 'default' | 'cancel' | 'destructive';
|
|
}
|
|
|
|
class PlatformAlert {
|
|
alert(title: string, message?: string, buttons?: AlertButton[]) {
|
|
RNAlert.alert(title, message, buttons);
|
|
}
|
|
|
|
toast(message: string, _duration: number = 2000) {
|
|
RNAlert.alert('', message);
|
|
}
|
|
}
|
|
|
|
export const Alert = new PlatformAlert();
|