ionic-team / pwa-elements

Quality UI experiences for Web APIs that require custom UI (such as media/camera).
https://medium.com/@maxlynch/building-the-progressive-web-app-os-57daebcb69c1
MIT License
168 stars 50 forks source link

Uncaught (in promise) TypeError: Cannot read property 'length' of undefined pwa-camera.entry.js?da8b:404 #67

Closed faithfulojebiyi closed 2 years ago

faithfulojebiyi commented 4 years ago

Resources: Before submitting an issue, please consult our docs.

Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):

oyfims-mobile@0.1.0 C:\Users\FAITHFUL\Desktop\apps\App\oyfims-mobile
`-- (empty)

I'm submitting a ... (check one with "x") [x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Error in console: Uncaught (in promise) TypeError: Cannot read property 'length' of undefined at class_1.eval (pwa-camera.entry.js?da8b:404) at step (pwa-camera.entry.js?da8b:32) at Object.eval [as next] (pwa-camera.entry.js?da8b:13) at fulfilled (pwa-camera.entry.js?da8b:4).

Expected behavior:

Steps to reproduce:

Related code:

async usePhotoCamera () {
        const cameraPhoto = await Camera.getPhoto({
          resultType: CameraResultType.Uri,
          source: CameraSource.Camera,
          quality: 100,
          allowEditing: true
        })

        this.camPhoto = cameraPhoto.webPath

        return cameraPhoto.webPath
    },

Other information: On tap button camera opens and works fine but once the camera is open theres an error in console.

shadowboxingskills commented 4 years ago

+1

faithfulojebiyi commented 4 years ago

+1

Are you experiencing the same thing too

shadowboxingskills commented 4 years ago

+1

Are you experiencing the same thing too

yes, getting same error

mtsmachado8 commented 4 years ago

i've got the same error. it occurs here on pwa-camera.entry.js:

if (c.fillLightMode.length > 1) {
                            this.flashModes = c.fillLightMode.map(function (m) { return m; });
                            // Try to recall the current flash mode
                            if (this.flashMode) {
                                this.flashMode = this.flashModes[this.flashModes.indexOf(this.flashMode)] || 'off';
                                this.flashIndex = this.flashModes.indexOf(this.flashMode) || 0;
                            }
                            else {
                                this.flashIndex = 0;
                            }
                        }
                        return [2 /*return*/];

Fixed with a simple:

if (c.fillLightMode && c.fillLightMode.length > 1) {
                            this.flashModes = c.fillLightMode.map(function (m) { return m; });
                            // Try to recall the current flash mode
                            if (this.flashMode) {
                                this.flashMode = this.flashModes[this.flashModes.indexOf(this.flashMode)] || 'off';
                                this.flashIndex = this.flashModes.indexOf(this.flashMode) || 0;
                            }
                            else {
                                this.flashIndex = 0;
                            }
                        }

not sure why it cant get fillLightMode though. opening a PR as soon as possible. Iam also getting a no Camera found on Rear camera. Still trying on that one

mtsmachado8 commented 4 years ago

PR #68 solves this issue

jcesarmobile commented 2 years ago

closing as #68 was merged