react-native-vision-camera: 🐛 `focus()` does not work and stops auto-focus

What’s happening?

This is similar issue as this https://github.com/mrousavy/react-native-vision-camera/issues/1938 but on Android platform. It seem it just turn off autofocus on Android. In V2 it is working well!

Reproduceable Code

const camera = useRef()

...

<Camera
  ref={camera}
  style={styles.container}
  device={device}
  photo
  zoom={zoom}
  isActive={isScreenFocused && !pictureTaken}
  onInitialized={() => setCameraReady(true)}
  orientation='portrait'
  onError={onError}/>

...

[some button press while camera ready] () => camera.current.focus({ x: 300, y: 300 });

Relevant log output

[no relevant log]

Camera Device

{
  "formats": undefined,
  "sensorOrientation": "landscape-right",
  "hardwareLevel": "full",
  "maxZoom": 20,
  "minZoom": 0.6704425811767578,
  "supportsLowLightBoost": true,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": true,
  "isMultiCam": true,
  "name": "BACK (0)",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Google Pixel 6 Pro

VisionCamera Version

3.3.1

Can you reproduce this issue in the VisionCamera Example app?

I didn’t try (⚠️ your issue might get ignored & closed if you don’t try this)

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

Working on focus this week 💪

Yup thanks - focus is just not properly implemented right now. That’s my fault, it was a bit more complex than I originally thought and other issues were just higher priority at that time. I’m back from my short vacation and I’ll take a look at this very soon, it’s pretty high priority on my TODO list.

First some emails to catch up on haha.

Thanks for the sponsorship @Brianwebb22 !

Okay yea, I think I know why. Takes some time to fix though

@rsnr Hey - might be! I was on vacation last week and today is Sunday, I’ll be back on Tuesday! 😃

I finally implemented focus now in #2523!

VisionCamera 3.9.0-beta.3 now includes this feature! 😃

Thanks @rsnr for sponsoring this btw 🙏