Closed EskelCz closed 5 years ago
This should be fixed in react-native-camera v2.3.0 https://github.com/react-native-community/react-native-camera/pull/1210
But that can't be used with Expo, I would have to eject the app.
(I've tried to use it but ran into this issue: undefined is not an object (evaluating 'CameraManager.Aspect')
)
Doesn't happen to me 🤔 I'm afraid you're alone on this one @EskelCz
@zepod Pasky reported the same issue with the same phone model (xiaomi redmi 6)
The issue is triggered by onCameraReady
prop when camera is remounted. I'll dig deeper.
@zepod I've spent like four hours trying to isolate the issue more precisely, to no avail. It's something deep in the underlying java.
The most elegant solution in my opinion would be to set the ratio just once, on first mount. Do you see some issue with that?
This is the bug, already reported: https://github.com/react-native-community/react-native-camera/issues/1369 It happens when unsupported aspect ratio is set.
Also I have a wrong aspect ratio, there is some other issue there, I'll look into it.
Turns out aspect ratio of camera doesn't necessarily equal aspect ratio of the screen. Seems like the best solution is to look for the highest aspect ratio the camera provides. There must already be a transformation of the ratio on the system level. This is therefore also the correct answer to the issue #1. https://github.com/react-native-community/react-native-camera/issues/1280#issuecomment-368644836
@zepod please test out if it works for your android device as well https://github.com/rossumai/elis-capture/pull/13
Doesn't work well on OPPO P9 Pro with aspect ratio 19.5:9 Problem may be the fact, that 19.5:9 is very esoteric.
@zepod Interesting. :) That's the aspect ratio of the camera?
What do you get from getSupportedRatiosAsync
?
["1:1", "2:1", "3:2", "4:3", "13:6", "16:9", "30:17"]
So the exact issue is that my phone returns 9:5 as a supported aspect ratio (the best, in fact), which when it is set, the app crashes. I've opened an issue with expo camera, here: https://github.com/expo/expo/issues/4174
When I delete a photo, the camera won't open again and sometimes expo will crash. When I click the camera icon to open camera again, expo crashes every time with this error:
This happens on real device, Xiaomi Redmi 6