transloadit / uppy

The next open source file uploader for web browsers :dog:
https://uppy.io
MIT License
28.95k stars 1.99k forks source link

mobileNativeWebcam does not work with React Dasboard #4315

Open mshunjan opened 1 year ago

mshunjan commented 1 year ago

Initial checklist

Link to runnable example

https://codesandbox.io/s/native-camera-uppy-7okmrk

Steps to reproduce

I've provided a minimal example above of the following steps:

  1. Create a react app with the uppy react Dashboard component
  2. Enable mobilenativecamera
  3. Open the ui on your mobile device

Expected behavior

A native camera view should appear, as is shown on the uppy landing page when on a mobile device

Actual behavior

The camera defaults to the in browser view. The source code requires a target, as shown in the code snippet below, but this doesn't seem to be possible with uppy's react components, at least according to the docs. https://github.com/transloadit/uppy/blob/7c9e1664012e417bac131e6708adf98baaffbb9c/packages/%40uppy/webcam/src/Webcam.jsx#L598-L610

leomelzer commented 10 months ago

Just stumbled over this issue, too. One way to make it work would be to simply set the prop on the dashboard itself:

const Foo = () => {
  const isMobileDevice = isMobile({tablet: true});

  return (
    <Dashboard
      showNativePhotoCameraButton={isMobileDevice}
      showNativeVideoCameraButton={isMobileDevice}
      // ...
    />
  );
}