Camera
has no propType for native prop RNCamera.detectedImageInEvent
of ……
小編在剛接觸 react-native-camera 的時候,每一步都按照步驟來,終于android studio編譯不報錯了
啟動react-native run-android結果走到調用camera的時候竟然又開始報錯了,小編找了好久的方案終于知道解決辦法了
!!! 竟然要改動node 引入的包里面的內容
去node_modules里面找到 RNCamera.js
圖一
在里面添加內容
const RNCamera = requireNativeComponent('RNCamera', Camera, {
nativeOnly: {
accessibilityComponentType: true,
accessibilityLabel: true,
accessibilityLiveRegion: true,
barCodeScannerEnabled: true,
touchDetectorEnabled: true,
googleVisionBarcodeDetectorEnabled: true,
faceDetectorEnabled: true,
textRecognizerEnabled: true,
importantForAccessibility: true,
onBarCodeRead: true,
onGoogleVisionBarcodesDetected: true,
onCameraReady: true,
onAudioInterrupted: true,
onAudioConnected: true,
onPictureSaved: true,
onFaceDetected: true,
onTouch: true,
onLayout: true,
onMountError: true,
onSubjectAreaChanged: true,
renderToHardwareTextureAndroid: true,
testID: true,
detectedImageInEvent: true, //這是我缺的 提示找不到什么就在這里面添加什么即可
cameraViewDimensions: true,
},
});
圖二
提示找不到什么就在這里面添加什么即可 .
參考文檔:解決方案