zalmoxisus / mobx-remotedev

MobX DevTools extension
MIT License
327 stars 40 forks source link

[React-native] Cannot read property 'getDebugName' of undefined #34

Open Fsarmento opened 6 years ago

Fsarmento commented 6 years ago

I have an app that works fine if I do not use/ reference mobx-remotedev. I can even use "react-native Debugger" to connect in debug mode and have access to the console.

However, when I add mobx-remotedev to a store, I get the error Cannot read property 'getDebugName' of undefined

// @flow
import remotedev from 'mobx-remotedev'    // <-- new
import { observable, action } from 'mobx'
import Orientation from 'react-native-orientation'
import { Keyboard, NetInfo, AppState, BackHandler } from 'react-native'

@remotedev({        // <-- new decorator
  name: 'AppStateStore',
  remote: true,
  global: true,
})
export default class AppStateStore {
  @observable keyboard: any
  @observable isConnected: boolean = true
  ...
}

error:

Cannot read property 'getDebugName' of undefined

handleException | @ | ExceptionsManager.js:63
-- | -- | --
  | handleError | @ | InitializeCore.js:69
  | reportFatalError | @ | error-guard.js:42
  | guardedLoadModule | @ | require.js:143
  | _require | @ | require.js:132
  | (anonymous) | @ | format.js:27
  | executeApplicationScript | @ | RNDebuggerWorker.js:1
  | t | @ | RNDebuggerWorker.js:1

"dependencies": { ... "react": "16.3.1", "react-native": "0.55.3", "mobx": "^5.0.3", "mobx-react": "^5.2.3", "mobx-remotedev": "^0.2.8", },

stevefan1999-personal commented 6 years ago

Pull this fork and link it in your NPM/Yarn global tree.

# git clone -b SimeonC-mobx-4 https://github.com/SimeonC/mobx-remotedev
# cd mobx-remotedev
# yarn || npm install
# yarn build || npm build
# yarn link || npm link
Fsarmento commented 6 years ago

Thanks @stevefan1999 !

I followed your instructions and then I did the following commands

# cd.. && cd peeqDaycare     (my_project)
# yarn link "mobx-remotedev"

but now I get the following error:

error: bundling failed: Error: Unable to resolve module `./getDecorator` from `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/index.js`: The module `./getDecorator` could not be found from `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/index.js`. Indeed, none of these files exist:

  * `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/getDecorator(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
  * `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/getDecorator/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`

My project is in the folder /Users/franciscosarmento/Dev/peeq/peeqDaycare and I cloned the fork to /Users/franciscosarmento/Dev/peeq/mobx-remotedev. Shouldn't it be getting the files from the fork folder instead after being linked?

What am I doing wrong?

stevefan1999-personal commented 6 years ago

Oh yes I've forgotten a build process :) @Fsarmento Try import remoteDev from 'mobx-remotedev/dist'

Fsarmento commented 6 years ago

Thanks @stevefan1999, I ended up using this fork directly by installing the package as yarn add mobx-remotedev@dayangdata/mobx-remotedev (it was also updated to allow mobx4 for react-native)

eugene-beliaev commented 6 years ago

Is anybody going to fix it?

samscarsella commented 6 years ago

Any updates on this?