Fork me on GitHub
#cljsrn
<
2022-08-11
>
muje hoxe08:08:49

any guide on accessing the camera?

joshmiller16:08:28

You should be able to just use one of the normal RN libraries from CLJS relatively easily. Either in Expo, or with a lib like https://github.com/mrousavy/react-native-vision-camera

👍 1
muje hoxe21:08:21

LOG Running "AwesomeProject" with {"rootTag":1} ERROR TypeError: undefined is not an object (evaluating 'device.id') here is the gist of the code (defn cam [] (let [devices (rnvc/useCameraDevices) device (. devices -back)] [:> rnvc/Camera {:device device :is-active true :style (. rn/StyleSheet -absoluteFill)}])) (defn root [] [:> rn/View {:style (.-container styles)} [:> rn/Text {:style (.-title styles)} "Hello!"] [:f> cam]])

muje hoxe21:08:03

can anyone help me with that

muje hoxe21:08:44

i think i should await for the camera permission request, now trying to translate the js code

joshmiller23:08:12

Yeah, from a quick look at the guide, you have to await Camera.requestCameraPermission(). I think if you just put your view behind an (if device ...) with a fallback loading/whatever screen, you’ll be fine.