Alert not available in SDK?

I am trying to use Alert. Typescript tells me there is no “Alert” export in “expo” and if I try to ignore that I get a runtime error:

Module src/utils/showError does not exist in the Haste module map.

import { Alert } from "expo";

export function showError(message: string, handleDismiss?: () => void) {
  Alert.alert(
    "An error occurred",
    message,
    [
      {
        text: "OK",
        onPress: () =>
          handleDismiss
            ? handleDismiss()
            : console.log(`Error dismissed: ${message}`)
      }
    ],
    { cancelable: false }
  );
}

Alert is not a component of Expo, for using Alert call like below code from react-native

import {Alert} from ‘react-native’;

Aha! :man_facepalming: Thanks!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.