I'm trying to use AlertIOS in a brand new React Native project, but for some reason I'm getting undefined
-related errors.
The relevant parts of the code:
import { AlertIOS } from 'react-native';
// Callback for a button press
const _alert = () => {
AlertIOS.alert('title', 'text')
}
If I'm not in debug mode, after clicking the button I get the error undefined is not an object (evaluating '_reactNative.AlertIOS.alert')
.
When debugging, the error changes to Cannot read property alert of undefined
and AlertIOS has the value shown in the print below, which doesn't seem right.
Also, if I just use Alert.alert
, it works (obviously changing the import).