prscX / react-native-photo-editor

React Native: Native Photo Editor
Apache License 2.0
1.12k stars 241 forks source link

TypeError: Cannot read property 'Edit' of undefined #186

Open ghasemikasra39 opened 3 years ago

ghasemikasra39 commented 3 years ago
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"
prscX commented 3 years ago

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 >

akshay-svmx commented 2 years ago

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

mohamedyassin60 commented 2 years ago

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

jaylin-slate commented 1 year ago

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