prscX / react-native-photo-editor

React Native: Native Photo Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'Edit' of undefined

ghasemikasra39 opened this issue · 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"

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 >

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

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

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