I'm trying to implement face detection in my Expo managed workflow project using the @infinitered/react-native-mlkit-face-detection library. I've followed the installation and setup steps, but I keep getting a "no module found" error. Below are the details of my implementation and the issue.
Steps I've Taken:
Installed the library:
npm install @infinitered/react-native-mlkit-face-detection
Set up the Expo development client: I configured a development client for my Expo managed workflow project
-
import { StyleSheet } from "react-native"; import { FaceDetectionProvider } from "@infinitered/react-native-mlkit-face-detection"; import FaceDetectionComponent from "./FaceDetectionComponent"; export default function App() { return ( <FaceDetectionProvider> <FaceDetectionComponent /> </FaceDetectionProvider> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#fff", alignItems: "center", justifyContent: "center", }, }); -
import { useFacesInPhoto } from "@infinitered/react-native-mlkit-face-detection"; export default function FaceDetectionComponent() { // imageUri must be a local file URI const { faces, error, status } = useFacesInPhoto( "local_uri_of_your_image_uri" ); if (error) { return <Text>Error: {error}</Text>; } return ( <View> {faces.map((face) => ( <View key={face.trackingId}> <Text>{JSON.stringify(face)}</Text> </View> ))} </View> ); } Error Message: Error: Cannot find native module 'RNMLKitFaceDetection'
Additional Information:
Expo version: [52.0.41]
React Native version: [0.76.7]
@infinitered/react-native-mlkit-face-detection: [3.1.0]