Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Fsarmento opened this issue Jul 30, 2018 · 6 comments
Open

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

Fsarmento opened this issue Jul 30, 2018 · 6 comments

Comments

@Fsarmento
Copy link

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
Copy link

stevefan1999-personal commented Aug 1, 2018

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
Copy link
Author

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
Copy link

stevefan1999-personal commented Aug 1, 2018

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

@Fsarmento
Copy link
Author

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
Copy link

Is anybody going to fix it?

@samscarsella
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants