I used LocalAuthentication I a bared React-Native project:
“react-native”: “0.61.5”,
“expo-local-authentication”: “^8.0.0”,
“react-native-unimodules”: “^0.8.1”,
undefined is not an object (evaluating ‘_ExpoLocalAuthentication.default.authenticateAsync’)
Any help pls?
make sure you run pod install
in the ios
directory and rebuild the project
Thank, the error persist with all methods:
e [TypeError: undefined is not an object (evaluatin’_ExpoLocalAuthentication.default.authenticateAsync’)
Just get log with AuthenticationType
{“1”: “FINGERPRINT”, “2”: “FACIAL_RECOGNITION”, “FACIAL_RECOGNITION”: 2, “FINGERPRINT”: 1}
my guess is that you are writing:
import LocalAuthentication from 'expo-local-authentication';
rather than
import * as LocalAuthentication from 'expo-local-authentication';
see docs https://docs.expo.io/versions/v36.0.0/sdk/local-authentication/
here’s a minimal working example. just tried it in a bare project with react-native-unimodules and expo-local-authentication and it worked as expected
import * as React from "react";
import { Button, StyleSheet, View } from "react-native";
import * as LocalAuthentication from "expo-local-authentication";
export default function App() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Button
title="Try it"
onPress={async () => {
let results = await LocalAuthentication.authenticateAsync();
if (results.success) {
alert("success!");
} else {
alert("fail");
}
}}
/>
</View>
);
}
thank you very much it was finally an error of mine where I did not correctly configure AppDelegate.h inside the iOS directory.
system
Closed
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.