Add option to use front camera when taking a picture

I noticed that it is only possible to use the rear camera when taking and attaching an Image. I would love to use the front camera too.

If this is approved to be a valid feature I would dive into the react-native app and fix this since this looks like a easy fix.

Yes sure I’d accept a pull request.

The current UI to take a photo is like this:

So I guess you’d add a smaller button, for example in the bottom right corner to switch between front and back? And there would have to be some code as well to detect if the device actually supports a front camera.

I think you are missing something here. The camera invoked by Joplin is not the OS's camera app. It's using its own code.
You can't invoke the camera app. What would happen, if a user deleted it? This is why Joplin uses its own code. As you can see you can't zoom or do any other fancy stuff. If you want/need that you will have to use your phone's app and use Attach photo instead of Take photo.

I added a smaller button with a reverse-camera icon, similiar to the original button. If you press it you can switch between front and back camera and take pictures.
Regarding your comment to add code to check if a front camera is available. If there is no front camera or the specified camera can not be found react-native-camera would default to the back camera. However I do not know of any smartphone without a front camera and if there is they would still get the Button to switch cameras but just without function since it would always default to the back cam.

Tested on Android and iOS Simulator.

1 Like

That sounds good @daehruoydeef. Indeed as long as pressing the button doesn’t crash or anything it’s fine. Feel free to create the pull request whenever you want (to qualify for Hacktoberfest you might want to wait till 1st October).

Just opened a PR, hope it gets merged and lands into official version. The code changes are really simple, most of it are new lay outing to arrange the buttons correctly.
I would love to qualify for hacktoberfest but since I really want this feature asap I opened the PR now. I will look into the issues if there is anything else I could do to qualify :slight_smile: