Bluesky app fork with some witchin' additions 馃挮
at readme-update 23 lines 696 B view raw
1import {type AlertButton, type AlertStatic} from 'react-native' 2 3class WebAlert implements Pick<AlertStatic, 'alert'> { 4 public alert(title: string, message?: string, buttons?: AlertButton[]): void { 5 if (buttons === undefined || buttons.length === 0) { 6 window.alert([title, message].filter(Boolean).join('\n')) 7 return 8 } 9 10 const result = window.confirm([title, message].filter(Boolean).join('\n')) 11 12 if (result === true) { 13 const confirm = buttons.find(({style}) => style !== 'cancel') 14 confirm?.onPress?.() 15 return 16 } 17 18 const cancel = buttons.find(({style}) => style === 'cancel') 19 cancel?.onPress?.() 20 } 21} 22 23export const Alert = new WebAlert()