react-native-photo-editor icon indicating copy to clipboard operation
react-native-photo-editor copied to clipboard

TypeError: Cannot read property 'Edit' of undefined

Open ghasemikasra39 opened this issue 4 years ago • 4 comments

import PhotoEditor from 'react-native-photo-editor'

    try {
      PhotoEditor.Edit({
        path: this.currentPath,
        hiddenControls: ['clear', 'draw', 'save', 'share', 'sticker', 'text'],
        onDone: async (uri) => {},
        onCancel: () => {}
      })
    } catch (err) {
      console.log('err ', err)
    }

Works perfectly on ios, but on android gives this error:

err  TypeError: Cannot read property 'Edit' of undefined
    at Function.Edit (C:\Users\Kasra\Documents\realnote_app\node_modules\react-native-photo-editor\index.tsx:54)
    at _callee3$ (VM8 src\screens\ConfirmProfileImage.bundle:165)
    at tryCatch (C:\Users\Kasra\Documents\realnote_app\node_modules\regenerator-runtime\runtime.js:63)
    at Generator.invoke [as _invoke] (C:\Users\Kasra\Documents\realnote_app\node_modules\regenerator-runtime\runtime.js:293)
    at Generator.next (C:\Users\Kasra\Documents\realnote_app\node_modules\regenerator-runtime\runtime.js:118)
    at tryCatch (C:\Users\Kasra\Documents\realnote_app\node_modules\regenerator-runtime\runtime.js:63)
    at invoke (C:\Users\Kasra\Documents\realnote_app\node_modules\regenerator-runtime\runtime.js:154)
    at C:\Users\Kasra\Documents\realnote_app\node_modules\regenerator-runtime\runtime.js:189
    at tryCallTwo (C:\Users\Kasra\Documents\realnote_app\node_modules\promise\setimmediate\core.js:45)
    at doResolve (C:\Users\Kasra\Documents\realnote_app\node_modules\promise\setimmediate\core.js:200)

Seems your auto-linking not working

"react-native": "0.64.1"
"react-native-photo-editor": "^1.0.10"

ghasemikasra39 avatar Jun 25 '21 09:06 ghasemikasra39

Thanks @ghasemikasra39 for reporting the issue. It looks weird.

I have just tried to run Example project on android and works fine. Could you please try the example project once. Let me know if it does not work for you.

May be you need to typescript configuration. tsconfig.json, tslint.json

Thanks </ Pranav >

prscX avatar Jun 26 '21 11:06 prscX

@ghasemikasra39 Is Your Issue resolved?? If Yes, how did you solve it? I am getting the same issue.

akshay-svmx avatar Mar 08 '22 06:03 akshay-svmx

It is now changed to PhotoEditor.Edit.open({ .... }). The documentation was never updated.

mohamedyassin60 avatar May 19 '22 01:05 mohamedyassin60

Anyone resloved this? I have been working on it over couple weeks :(

jaylin-slate avatar Sep 08 '22 11:09 jaylin-slate