`Camera` has no propType for native prop ... 解決方案

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,
  },
});
圖二

提示找不到什么就在這里面添加什么即可 .

參考文檔解決方案

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。