react-native-vin-plate-recognizer
v0.1.0
Published
On-device VIN, UAE plate, and general text OCR (ML Kit on Android, Vision on iOS)
Maintainers
Readme
react-native-vin-plate-recognizer
On-device OCR for React Native. Google ML Kit on Android, Apple Vision on iOS. No network calls.
Scan modes:
| mode | Result type | What you get |
| --- | --- | --- |
| 'vin' | 'vin' | 17-character VIN in value |
| 'plate' | 'plate' | UAE plate in emirate, category, number |
| 'default' | 'text' | Every recognized line in value, joined with newlines |
'default' does not filter. Part codes, serials, and any other text are returned as the camera read them.
Install
npm install react-native-vin-plate-recognizer react-native-nitro-modules react-native-vision-cameraThen install pods (cd ios && pod install).
Usage
import { Camera, useCameraDevice, useFrameOutput } from 'react-native-vision-camera';
import { useSharedValue } from 'react-native-reanimated';
import { VinPlateRecognizerModule, VinPlateResult } from 'react-native-vin-plate-recognizer';
const scanMode = useSharedValue<'plate' | 'vin' | 'default'>('default');
const frameOutput = useFrameOutput({
pixelFormat: 'rgb',
onFrame(frame) {
'worklet';
const result = VinPlateRecognizerModule.recognize(frame, scanMode.value);
frame.dispose();
if (result.type === 'text' && result.value) {
// one recognized line per entry — a part code can be any of them
const lines = result.value.split('\n');
}
},
});pixelFormat: 'rgb' is required. Planar YUV frames are rejected with raw: "frame_not_rgb".
