A new project created with the latest version of react-native throws javascript error while running(/debugging). Tested this on simulator.
[fatal][tid:main] TypeError: babelHelpers.typeof is not a function. (In 'babelHelpers.typeof(target)', 'babelHelpers.typeof' is undefined)
Installed the react-native client today & created the app using
react-native init AwesomeProject
App version:
react-native-cli: 0.1.10
react-native: 0.20.0
node version: v5.6.0
Here's a comment explaining the issue:
https://github.com/facebook/react-native/issues/4844#issuecomment-204035720
To summarize:
Babel presets
'stage-0'
through'stage-3'
contain'async-to-generator'
, which is not not necessary for react-native itself.The solution is to use the unofficial babel preset
'react-native-stage-0'
Example:
.babelrc
or with decorator support
Empty cache and Restart