react-native-mlkit
react-native-mlkit copied to clipboard
Infinite Re-renders
Rn: 0.79.5 Expo: 53 my app keeps on rerendering
const MODELS: ObjectDetectionConfig = {
selfieDetector: {
model: require("../assets/models/selfie_multiclass_256x256.tflite"),
},
};
export default function RootLayout() {
// Load the models
const models = useObjectDetectionModels({
assets: MODELS,
loadDefaultModel: false,
defaultModelOptions: {
shouldEnableMultipleObjects: true,
shouldEnableClassification: true,
detectorMode: "singleImage",
},
});
// Get the provider component
const { ObjectDetectionProvider } = useObjectDetectionProvider(models);
return (
<ObjectDetectionProvider>
<! -- children -->
</ObjectDetectionProvider>
);