question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native : Uncaught ReferenceError: nameof is not defined error at runtime

See original GitHub issue

I’m trying to use your utility in a ReactXP project. I’ve followed the instruction to reference the path. It compiles ok, but I have the following error at runtime on web:

Uncaught ReferenceError: nameof is not defined
    at Object.EditExerciseCategoryPropertiesPanel._this._onChangeActivityTag [as onActivityTagChange] (EditExerciseCategoryPropertiesPanel.tsx:120)
    at Object.CategoryPicker._this._onActivityTagValueChange [as onValueChange] (CategoryPicker.tsx:84)
    at Picker._this._onValueChange (Picker.js:32)
    at HTMLUnknownElement.callCallback (react-dom.development.js:1299)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:1338)
    at Object.invokeGuardedCallback (react-dom.development.js:1195)
    at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:1209)
    at executeDispatch (react-dom.development.js:1432)
    at Object.executeDispatchesInOrder (react-dom.development.js:1454)
    at executeDispatchesAndRelease (react-dom.development.js:1969)
EditExerciseCategoryPropertiesPanel._this._onChangeActivityTag @ EditExerciseCategoryPropertiesPanel.tsx:120
CategoryPicker._this._onActivityTagValueChange @ CategoryPicker.tsx:84
Picker._this._onValueChange @ Picker.js:32
callCallback @ react-dom.development.js:1299
invokeGuardedCallbackDev @ react-dom.development.js:1338
invokeGuardedCallback @ react-dom.development.js:1195
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:1209
executeDispatch @ react-dom.development.js:1432
executeDispatchesInOrder @ react-dom.development.js:1454
executeDispatchesAndRelease @ react-dom.development.js:1969
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:1980
forEachAccumulated @ react-dom.development.js:1946
processEventQueue @ react-dom.development.js:2139
runEventQueueInBatch @ react-dom.development.js:2151
handleTopLevel @ react-dom.development.js:2161
handleTopLevelImpl @ react-dom.development.js:1800
batchedUpdates @ react-dom.development.js:13238
performFiberBatchedUpdates @ react-dom.development.js:1646
stackBatchedUpdates @ react-dom.development.js:1637
batchedUpdates @ react-dom.development.js:1651
batchedUpdatesWithControlledComponents @ react-dom.development.js:1664
dispatchEvent @ react-dom.development.js:1874
react-dom.development.js:1345 Uncaught Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://fb.me/react-crossorigin-error for more information.
    at Object.invokeGuardedCallbackDev (react-dom.development.js:1345)
    at Object.invokeGuardedCallback (react-dom.development.js:1195)
    at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:1209)
    at executeDispatch (react-dom.development.js:1432)
    at Object.executeDispatchesInOrder (react-dom.development.js:1454)
    at executeDispatchesAndRelease (react-dom.development.js:1969)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:1980)
    at Array.forEach (<anonymous>)
    at forEachAccumulated (react-dom.development.js:1946)
    at Object.processEventQueue (react-dom.development.js:2139)
invokeGuardedCallbackDev @ react-dom.development.js:1345
invokeGuardedCallback @ react-dom.development.js:1195
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:1209
executeDispatch @ react-dom.development.js:1432
executeDispatchesInOrder @ react-dom.development.js:1454
executeDispatchesAndRelease @ react-dom.development.js:1969
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:1980
forEachAccumulated @ react-dom.development.js:1946
processEventQueue @ react-dom.development.js:2139
runEventQueueInBatch @ react-dom.development.js:2151
handleTopLevel @ react-dom.development.js:2161
handleTopLevelImpl @ react-dom.development.js:1800
batchedUpdates @ react-dom.development.js:13238
performFiberBatchedUpdates @ react-dom.development.js:1646
stackBatchedUpdates @ react-dom.development.js:1637
batchedUpdates @ react-dom.development.js:1651
batchedUpdatesWithControlledComponents @ react-dom.development.js:1664
dispatchEvent @ react-dom.development.js:1874

On iPhone:

Can't find variable: nameof
_onChangeActivityTag
EditExerciseCategoryPropertiesPanel.js:73:30

Android:

Can't find variable: nameof
_onChangeActivityTag
    EditExerciseCategoryPropertiesPanel.js:73:30
_onActivityTagValueChange
    CategoryPicker.js:52:48
onValueChange
    Picker.js:38:38
_onChange
    PickerAndroid.android.js:120:33
invokeGuardedCallback
    ReactNativeStack-dev.js:130:19
invokeGuardedCallback
    ReactNativeStack-dev.js:166:43
invokeGuardedCallbackAndCatchFirstError
    ReactNativeStack-dev.js:169:64
executeDispatch
    ReactNativeStack-dev.js:202:128
executeDispatchesInOrder
    ReactNativeStack-dev.js:208:279
executeDispatchesAndRelease
    ReactNativeStack-dev.js:272:58
executeDispatchesAndReleaseTopLevel
    ReactNativeStack-dev.js:276:39
forEachAccumulated
    ReactNativeStack-dev.js:268:65
processEventQueue
    ReactNativeStack-dev.js:340:143
runEventQueueInBatch
    ReactNativeStack-dev.js:637:79
handleTopLevel
    ReactNativeStack-dev.js:642:29
<unknown>
    ReactNativeStack-dev.js:749:51
fiberBatchedUpdates
    ReactNativeStack-dev.js:691:14
performFiberBatchedUpdates
    ReactNativeStack-dev.js:695:31
perform
    ReactNativeStack-dev.js:1382:99
batchedUpdates
    ReactNativeStack-dev.js:2077:139
batchedUpdates$1
    ReactNativeStack-dev.js:1456:61
batchedUpdates
    ReactNativeStack-dev.js:699:31
batchedUpdatesWithControlledComponents
    ReactNativeStack-dev.js:708:30
_receiveRootNodeIDEvent
    ReactNativeStack-dev.js:748:46
receiveEvent
    ReactNativeStack-dev.js:754:56
__callFunction
    MessageQueue.js:306:47
<unknown>
    MessageQueue.js:108:26
__guard
    MessageQueue.js:269:6
callFunctionReturnFlushedQueue
    MessageQueue.js:107:17

Any help appreciated.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ozyman42commented, May 18, 2019

Interestingly, I was able to get things working via the ts-nameof-loader, but not with the custom transformer. I may look into this more in the future, but for now I’ll just use the loader.

0reactions
dsherretcommented, Dec 4, 2018

Following up on this… there is a new setup for webpack that allows you to easily inject this library as a custom transformer: https://github.com/dsherret/ts-nameof/blob/master/setup/webpack.md

Unfortunately this library doesn’t work with babel. Read more here: https://github.com/dsherret/ts-nameof/issues/37#issuecomment-443548609

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: Buffer is not defined - Stack Overflow
Answering my own question. Two things helped to resolve the issue: Adding plugins section with ProviderPlugin into webpack.config.js.
Read more >
global is not defined react - You.com | The AI Search Engine ...
I am getting this error: Uncaught ReferenceError: React is not defined But I can access the React object in browser console I also...
Read more >
3 Ways to Solve jQuery - Uncaught ReferenceError: $ is not ...
In this article, you will see some of the most common reasons for "Uncaught ReferenceError: $ is not defined" errors and how to...
Read more >
AppRegistry - React Native
You do not need to use this API. AppRegistry is the JS entry point to running all React Native apps. App root components...
Read more >
Troubleshooting Common Errors - Gatsby
You may encounter an error like Error: ReferenceError: window is not defined that you didn't see in development if you reference browser globals...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found