react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

πŸ› QR Code only detected in top-right corner on Samsung A23

Open olivertylsar opened this issue 11 months ago β€’ 9 comments

What's happening?

Issue Description On the Samsung A23, the camera has trouble detecting QR codes when using the example app's CodeScannerPage. No additional props were passed to the Camera component.

Through testing, we discovered that the QR code is recognized only when positioned in the top-right corner of the frame. In all other positions, the detection fails. However, the same QR code is instantly detected anywhere in the frame when using the native camera app.

Related Issue A similar issue was reported here: #3248. However, in our case, the issue can be consistently reproduced in the example app.

The suggested workaround of specifying a format did not resolve the issue and instead resulted in a black screen.

Reproduction Here is a video showing the issue on a Samsung A23:

https://github.com/user-attachments/assets/03e77b13-bbb4-45bc-8e6d-8e292a37f204

For comparison, the same code works correctly on a Samsung S21, where the QR code is detected anywhere in the frame: https://github.com/user-attachments/assets/a54112d8-98be-44f2-830f-9daed5609c45

Additional Notes The issue is reproducible in the example app without modifications. The same QR code is detected properly by the native camera app, regardless of its position. Other devices, such as the Samsung S21, do not exhibit this issue. Specifying a format as a workaround caused a black screen rather than resolving the problem. This behavior suggests a potential issue with how the camera processes frames on the Samsung A23. Any insights or potential fixes would be greatly appreciated. Thanks! πŸš€

Reproduceable Code

// 1. Use a simple default back camera
  const device = useCameraDevice('back')

  // 2. Only activate Camera when the app is focused and this screen is currently opened
  const isFocused = useIsFocused()
  const isForeground = useIsForeground()
  const isActive = isFocused && isForeground

  // 3. (Optional) enable a torch setting
  const [torch, setTorch] = useState(false)

  // 4. On code scanned, we show an aler to the user
  const isShowingAlert = useRef(false)
  const onCodeScanned = useCallback((codes: Code[]) => {
    console.log(`Scanned ${codes.length} codes:`, codes)
    const value = codes[0]?.value
    if (value == null) return
    if (isShowingAlert.current) return
    showCodeAlert(value, () => {
      isShowingAlert.current = false
    })
    isShowingAlert.current = true
  }, [])

  // 5. Initialize the Code Scanner to scan QR codes and Barcodes
  const codeScanner = useCodeScanner({
    codeTypes: ['qr', 'ean-13'],
    onCodeScanned: onCodeScanned,
  })

  return (
    <View style={styles.container}>
      {device != null && (
        <Camera
          style={StyleSheet.absoluteFill}
          device={device}
          isActive={isActive}
          codeScanner={codeScanner}
          torch={torch ? 'on' : 'off'}
          enableZoomGesture={true}
        />
      )}

      <StatusBarBlurBackground />

      <View style={styles.rightButtonRow}>
        <PressableOpacity style={styles.button} onPress={() => setTorch(!torch)} disabledOpacity={0.4}>
          <IonIcon name={torch ? 'flash' : 'flash-off'} color="white" size={24} />
        </PressableOpacity>
      </View>

      {/* Back Button */}
      <PressableOpacity style={styles.backButton} onPress={navigation.goBack}>
        <IonIcon name="chevron-back" color="white" size={35} />
      </PressableOpacity>
    </View>
  )

Relevant log output

2025-02-26 10:39:58.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:39:59.021 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:00.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:01.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:02.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:02.094 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 296, y: 98, height: 303, x: -12 },
                                                                                                        corners: 
                                                                                                         [ { y: 101, x: -12 },
                                                                                                           { y: 98, x: 284 },
                                                                                                           { y: 398, x: 273 },
                                                                                                           { y: 401, x: -10 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.099 32497-32497 OnBackInvokedCallback   com.mrousavy.camera.example          W  OnBackInvokedCallback is not enabled for the application.
                                                                                                    Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
2025-02-26 10:40:02.101 32497-32497 Dialog                  com.mrousavy.camera.example          I  mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
2025-02-26 10:40:02.108 32497-32497 DecorView               com.mrousavy.camera.example          I  [INFO] isPopOver=false config=false
2025-02-26 10:40:02.108 32497-32497 DecorView               com.mrousavy.camera.example          I  updateCaptionType: isFloating=true isApplication=true hasWindowDecorCaption=false this=DecorView@6495f75[]
2025-02-26 10:40:02.108 32497-32497 DecorView               com.mrousavy.camera.example          D  setCaptionType = 0, this = DecorView@6495f75[]
2025-02-26 10:40:02.112 32497-32497 DecorView               com.mrousavy.camera.example          I  setWindowBackground: isPopOver=false color=fff6f6f6 d=android.graphics.drawable.InsetDrawable@d6a9f7b
2025-02-26 10:40:02.129 32497-32497 ScrollView              com.mrousavy.camera.example          D  initGoToTop
2025-02-26 10:40:02.140 32497-32566 NativeCust...ncyManager com.mrousavy.camera.example          D  [NativeCFMS] BpCustomFrequencyManager::BpCustomFrequencyManager()
2025-02-26 10:40:02.141 32497-32497 DecorView               com.mrousavy.camera.example          I  notifyKeepScreenOnChanged: keepScreenOn=false
2025-02-26 10:40:02.156 32497-32497 InsetsController        com.mrousavy.camera.example          D  onStateChanged: InsetsState: {mDisplayFrame=Rect(0, 0 - 1080, 2408), mDisplayCutout=DisplayCutout{insets=Rect(0, 65 - 0, 0) waterfall=Insets{left=0, top=0, right=0, bottom=0} boundingRect={Bounds=[Rect(0, 0 - 0, 0), Rect(454, 0 - 626, 65), Rect(0, 0 - 0, 0), Rect(0, 0 - 0, 0)]} cutoutPathParserInfo={CutoutPathParserInfo{displayWidth=1080 displayHeight=2408 physicalDisplayWidth=1080 physicalDisplayHeight=2408 density={2.8125} cutoutSpec={M 0,0 H -30.57777777777778 V 23.11111111111111 H 30.57777777777778 V 0 H 0 Z @dp} rotation={0} scale={1.0} physicalPixelDisplaySizeRatio={1.0}}}}, mRoundedCorners=RoundedCorners{[RoundedCorner{position=TopLeft, radius=90, center=Point(90, 90)}, RoundedCorner{position=TopRight, radius=90, center=Point(990, 90)}, RoundedCorner{position=BottomRight, radius=90, center=Point(990, 2318)}, RoundedCorner{position=BottomLeft, radius=90, center=Point(90, 2318)}]}  mRoundedCornerFrame=Rect(0, 0 - 1080, 2408), mPrivacyIndicatorBounds=PrivacyIndicatorBounds {static bounds=Rect(956, 0 - 1080, 70) rotation=0}, mSources= { InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,70], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,2273][1080,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_LEFT_GESTURES, mFrame=[0,0][0,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_RIGHT_GESTURES, mFrame=[1080,0][1080,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_TOP_MANDATORY_GESTURES, mFrame=[0,0][1080,99], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_BOTTOM_MANDATORY_GESTURES, mFrame=[0,2273][1080,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_LEFT_DISPLAY_CUTOUT, mFrame=[0,0][-100000,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_TOP_DISPLAY_CUTOUT, mFrame=[0,0][1080,65], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_RIGHT_DISPLAY_CUTOUT, mFrame=[100000,0][1080,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_BOTTOM_DISPLAY_CUTOUT, mFrame=[0,100000][1080,2408], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_TOP_TAPPABLE_ELEMENT, mFrame=[0,0][1080,70], mVisible=true, mInsetsRoundedCornerFrame=false}, InsetsSource: {mType=ITYPE_BOTTOM_TAPPABLE_ELEMENT, mFrame=[0,2273][1080,2408], mVisible=true, mInsetsRoundedCornerFrame=false} } host=com.mrousavy.camera.example/com.mrousavy.camera.example.MainActivity from=android.view.ViewRootImpl.setView:1732
2025-02-26 10:40:02.158 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  setView = com.android.internal.policy.DecorView@6495f75 TM=true
2025-02-26 10:40:02.167 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  performTraversals params={(0,0)(wrapxwrap) gr=CENTER sim={adjust=pan forwardNavigation} ty=APPLICATION fmt=TRANSLUCENT wanim=0x7f110003 surfaceInsets=Rect(113, 113 - 113, 113)
                                                                                                      fl=5820002
                                                                                                      pfl=2000000
                                                                                                      vsysui=500
                                                                                                      bhv=DEFAULT
                                                                                                      fitTypes=NAVIGATION_BARS CAPTION_BAR
                                                                                                     dimAmount=0.6 naviIconColor=0
                                                                                                      sfl=100000}
2025-02-26 10:40:02.168 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  performTraversals mFirst=true windowShouldResize=false viewVisibilityChanged=false mForceNextWindowRelayout=false params={(0,0)(wrapxwrap) gr=CENTER sim={adjust=pan forwardNavigation} ty=APPLICATION fmt=TRANSLUCENT wanim=0x7f110003 surfaceInsets=Rect(113, 113 - 113, 113)
                                                                                                      fl=5820002
                                                                                                      pfl=2000000
                                                                                                      vsysui=500
                                                                                                      bhv=DEFAULT
                                                                                                      fitTypes=NAVIGATION_BARS CAPTION_BAR
                                                                                                     dimAmount=0.6 naviIconColor=0
                                                                                                      sfl=100000}
2025-02-26 10:40:02.186 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  updateBlastSurfaceIfNeeded mBlastBufferQueue=null isSameSurfaceControl=false
2025-02-26 10:40:02.187 32497-32497 BLASTBufferQueue        com.mrousavy.camera.example          I  new BLASTBufferQueue, mName= ViewRootImpl@f8c561[MainActivity] mNativeObject= 0xb400007877482300 sc.mNativeObject= 0xb4000078eabfd4e0 caller= android.view.ViewRootImpl.updateBlastSurfaceIfNeeded:2909 android.view.ViewRootImpl.relayoutWindow:9847 android.view.ViewRootImpl.performTraversals:3884 android.view.ViewRootImpl.doTraversal:3116 android.view.ViewRootImpl$TraversalRunnable.run:10885 android.view.Choreographer$CallbackRecord.run:1301 android.view.Choreographer$CallbackRecord.run:1309 android.view.Choreographer.doCallbacks:923 android.view.Choreographer.doFrame:852 android.view.Choreographer$FrameDisplayEventReceiver.run:1283 
2025-02-26 10:40:02.188 32497-32497 BLASTBufferQueue        com.mrousavy.camera.example          I  update, w= 1252 h= 775 mName = ViewRootImpl@f8c561[MainActivity] mNativeObject= 0xb400007877482300 sc.mNativeObject= 0xb4000078eabfd4e0 format= -3 caller= android.graphics.BLASTBufferQueue.<init>:84 android.view.ViewRootImpl.updateBlastSurfaceIfNeeded:2909 android.view.ViewRootImpl.relayoutWindow:9847 android.view.ViewRootImpl.performTraversals:3884 android.view.ViewRootImpl.doTraversal:3116 android.view.ViewRootImpl$TraversalRunnable.run:10885 
2025-02-26 10:40:02.188 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  Relayout returned: old=(0,70,1080,2273) new=(27,897,1053,1446) req=(1026,549)0 dur=18 res=0x3 s={true 0xb40000781d03f800} ch=true seqId=0
2025-02-26 10:40:02.191 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  mThreadedRenderer.initialize() mSurface={isValid=true 0xb40000781d03f800} hwInitialized=true
2025-02-26 10:40:02.191 32497-32566 OpenGLRenderer          com.mrousavy.camera.example          D  eglCreateWindowSurface
2025-02-26 10:40:02.194 32497-32497 ScrollView              com.mrousavy.camera.example          D   onsize change changed 
2025-02-26 10:40:02.195 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  reportNextDraw android.view.ViewRootImpl.performTraversals:4438 android.view.ViewRootImpl.doTraversal:3116 android.view.ViewRootImpl$TraversalRunnable.run:10885 android.view.Choreographer$CallbackRecord.run:1301 android.view.Choreographer$CallbackRecord.run:1309 
2025-02-26 10:40:02.195 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  Setup new sync id=0
2025-02-26 10:40:02.195 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  Setting syncFrameCallback
2025-02-26 10:40:02.195 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  registerCallbacksForSync syncBuffer=false
2025-02-26 10:40:02.199 32497-32593 ViewRootIm...nActivity] com.mrousavy.camera.example          I  Received frameDrawingCallback syncResult=0 frameNum=1.
2025-02-26 10:40:02.199 32497-32593 ViewRootIm...nActivity] com.mrousavy.camera.example          I  Setting up sync and frameCommitCallback
2025-02-26 10:40:02.202 32497-32566 BLASTBufferQueue        com.mrousavy.camera.example          I  [ViewRootImpl@f8c561[MainActivity]#52](f:0,a:0) onFrameAvailable the first frame is available
2025-02-26 10:40:02.203 32497-32566 ViewRootIm...nActivity] com.mrousavy.camera.example          I  Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true
2025-02-26 10:40:02.204 32497-32566 OpenGLRenderer          com.mrousavy.camera.example          D  CFMS:: SetUp Pid : 32497    Tid : 32566
2025-02-26 10:40:02.205 32497-32566 Parcel                  com.mrousavy.camera.example          W  Expecting binder but got null!
2025-02-26 10:40:02.206 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  onSyncComplete
2025-02-26 10:40:02.207 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  setupSync seqId=0 mSyncId=0 fn=1 caller=android.view.ViewRootImpl$$ExternalSyntheticLambda11.accept:6 android.window.SurfaceSyncer.lambda$setupSync$1$android-window-SurfaceSyncer:128 android.window.SurfaceSyncer$$ExternalSyntheticLambda1.accept:8 android.window.SurfaceSyncer$SyncSet.checkIfSyncIsComplete:382 android.window.SurfaceSyncer$SyncSet.markSyncReady:359 android.window.SurfaceSyncer.markSyncReady:151 android.view.ViewRootImpl.performTraversals:4503 
2025-02-26 10:40:02.207 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  reportDrawFinished seqId=0 mSyncId=-1 fn=1 mSurfaceChangedTransaction=0xb4000078eac9ba00
2025-02-26 10:40:02.218 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  MSG_WINDOW_FOCUS_CHANGED 0 0
2025-02-26 10:40:02.224 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 296, y: 97, height: 303, x: -9 },
                                                                                                        corners: 
                                                                                                         [ { y: 102, x: -9 },
                                                                                                           { y: 97, x: 287 },
                                                                                                           { y: 399, x: 276 },
                                                                                                           { y: 400, x: -9 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.258 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  MSG_WINDOW_FOCUS_CHANGED 1 0
2025-02-26 10:40:02.258 32497-32497 ViewRootIm...nActivity] com.mrousavy.camera.example          I  mThreadedRenderer.initializeIfNeeded()#2 mSurface={isValid=true 0xb40000781d03f800}
2025-02-26 10:40:02.272 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 299, y: 87, height: 304, x: -5 },
                                                                                                        corners: 
                                                                                                         [ { y: 91, x: -3 },
                                                                                                           { y: 87, x: 294 },
                                                                                                           { y: 390, x: 284 },
                                                                                                           { y: 391, x: -5 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.356 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 300, y: 76, height: 307, x: -4 },
                                                                                                        corners: 
                                                                                                         [ { y: 81, x: -2 },
                                                                                                           { y: 76, x: 296 },
                                                                                                           { y: 381, x: 285 },
                                                                                                           { y: 383, x: -4 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.423 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 300, y: 66, height: 309, x: -12 },
                                                                                                        corners: 
                                                                                                         [ { y: 74, x: -12 },
                                                                                                           { y: 66, x: 288 },
                                                                                                           { y: 371, x: 280 },
                                                                                                           { y: 375, x: -12 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.508 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 291, y: 67, height: 307, x: -10 },
                                                                                                        corners: 
                                                                                                         [ { y: 76, x: -10 },
                                                                                                           { y: 67, x: 281 },
                                                                                                           { y: 368, x: 275 },
                                                                                                           { y: 374, x: -10 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.558 32497-32618 ReactNativeJS           com.mrousavy.camera.example          I  'Scanned 1 codes:', [ { frame: { width: 291, y: 76, height: 306, x: 4 },
                                                                                                        corners: 
                                                                                                         [ { y: 83, x: 7 },
                                                                                                           { y: 76, x: 295 },
                                                                                                           { y: 382, x: 288 },
                                                                                                           { y: 381, x: 4 } ],
                                                                                                        value: 'SPD*1.0*ACC:CZ2003000000000000000019*AM:1*CC:CZK',
                                                                                                        type: 'qr' } ]
2025-02-26 10:40:02.867 32497-32497 CameraSession           com.mrousavy.camera.example          I  Output orientation changed! LANDSCAPE_RIGHT
2025-02-26 10:40:02.868 32497-32497 CameraView              com.mrousavy.camera.example          I  invokeOnOutputOrientationChanged(LANDSCAPE_RIGHT)
2025-02-26 10:40:03.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:03.989 32497-32497 CameraSession           com.mrousavy.camera.example          I  Output orientation changed! LANDSCAPE_LEFT
2025-02-26 10:40:03.989 32497-32497 CameraView              com.mrousavy.camera.example          I  invokeOnOutputOrientationChanged(LANDSCAPE_LEFT)
2025-02-26 10:40:04.023 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:05.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:06.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:07.022 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:08.023 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)
2025-02-26 10:40:09.024 32497-32666 CameraView              com.mrousavy.camera.example          I  invokeOnAverageFpsChanged(0.0)

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 8,
  "minZoom": 1,
  "maxExposure": 20,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "minFocusDistance": 10,
  "minExposure": -20,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Samsung Galaxy A23 5G (Android 13) NOT OK, Samsung Galaxy S21 (Android 14) OK

VisionCamera Version

4.6.4

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

olivertylsar avatar Feb 26 '25 09:02 olivertylsar

Guten Tag, Hans here! 🍻

Thank you for your detailed report! It looks like you have provided a lot of useful information, and I see that you can reproduce this issue consistently on the Samsung A23.

Mrousavy will definitely want to look into this, but it might be difficult without proper logs during the reproduction. Could you please gather Android logs using adb logcat while reproducing the problem? This will help us diagnose what's going wrong.

Also, if you find this project helpful, consider supporting it on GitHub Sponsors so mrousavy can prioritize issues.

Let’s resolve this!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

maintenance-hans[bot] avatar Feb 26 '25 09:02 maintenance-hans[bot]

My customers with same phone have the same issue. Any updates about @mrousavy ? Thanks

capognavalerio avatar Mar 18 '25 14:03 capognavalerio

Same issue was reported in a Flutter camera library. https://github.com/juliansteenbakker/mobile_scanner/issues/698

They belive the issue can be fixed by changing the image format from YUV to NV21 before passing it to the MLKit. https://github.com/juliansteenbakker/mobile_scanner/issues/1116

olivertylsar avatar Mar 24 '25 16:03 olivertylsar

@olivertylsar @mrousavy I'm having the same issue here. Specifying the format as a fix, worked well before upgrading RN version to 0.76 and react-native-vision-camera version.

After the upgrade, my A23's users are experiencing a black screen as Oliver mentioned, and QR codes are only detected in the top right corner.

mauripavan avatar Apr 03 '25 19:04 mauripavan

I tried these tips from https://github.com/mrousavy/react-native-vision-camera/issues/3248#issuecomment-2789562786 and in my case, just passing photo={true} to the Camera component fixes the issue.

I'm not sure how exactly this prop impacts this issue, based on the prop annotation it should not be relevant, but it looks like it is working just fine for Samsung A23 - immediate QR detection anywhere in the frame + no black screen (no need to pass a format which otherwise still causes it).

I haven't tested it on other devices yet since I just found out, but looks promising. 🀞

olivertylsar avatar Apr 10 '25 09:04 olivertylsar

Hello @olivertylsar, I have the same issue after update from 4.5.3 to 4.6.4 With 4.5.3 we used hardcoded 640x480 format for A23 Did photo={true} helped for you without hardcoding 640x480 format for A23, right?

zwerg44 avatar May 16 '25 11:05 zwerg44

@zwerg44 Passing photo={true} indeed fixed the issue for the A23 model. The format prop workaround didn't work for me and was causing black screen.

But I recommend to use photo={true} only for this specific device, it didn't work well on iOS (the frame went black or freezed sometimes).

olivertylsar avatar May 16 '25 11:05 olivertylsar

Same problem occurs on Realme C67. QR code is only detected in the top-right corner on this device. I assume the workaround will work for this device as well.

@zwerg44 I saw you listed all model names for the Samsung A23 here https://github.com/mrousavy/react-native-vision-camera/issues/3248#issuecomment-2420031911. Do you have a reference how to find out the actual model name for Realme C67 to include it into the problematic models without having the physical device? Otherwise I might use the photo prop for all android devices as these two might not be the only ones having this issue.

olivertylsar avatar Jun 17 '25 07:06 olivertylsar

Hi @olivertylsar

I got the list from this flutter app: https://github.com/digitalfabrik/entitlementcard/pull/1524/files I saw link to this PR mentioned in flutter camera lib issue discussion about A23. And I suspect it's actually not the full list of A23 devices.

On my side I have an internal app, and I just have quite a lot of users with SM-A236B

I guess you can try:

  • to dig device statistics from your firebase or other analytics
  • google play console has device catalog
  • or just google it

On my side I know that most of my A23 are SM-A236B - from firebase analytics dashboard.

zwerg44 avatar Jun 17 '25 08:06 zwerg44