expo: expo-camera flip front to back camera don't work when use `useCamera2Api`

🐛 Bug Report

Environment

expo-camera: 4.0.0 react-native: 0.59.8 react-native-unimodules: 0.3.1

Steps to Reproduce

Use own code from Camera basic-example

Expected Behavior

When you clicking on the text flip (from the example above) at first time the camera is changing but if you press again nothing happens

if you remove useCamera2Api: true, then everything works as needed

Actual Behavior

flip behavior work without the dependency of useCamera2Api

Reproducible Demo

https://snack.expo.io/@retyui/f0fc5c

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 12
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Leaving this here in case someone else might find it useful…

  <Camera
    key={`camera-${type}`} // https://github.com/expo/expo/issues/4192
    type={type}
    useCamera2Api
  />

Since the key is also changed, the Camera component is forced to re-render. Still not a great solution but a little nicer than a timeout.