Reputation: 2680
I keep getting an error SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
I think it is because I have a line like this:
const shouldSet = touches.length === 1;
if (shouldSet) {
const { onPanBegin } = this.props;
Upvotes: 4
Views: 7678
Reputation: 1028
you need get the lastest version of react-native.
pod 'React', '0.13.0-rc'
Upvotes: 0
Reputation: 16466
Update 2015-10-23: as of React Native v0.13.0-rc const
is now enabled.
React Native's JavaScript environment is not a browser, instead it uses JavaScriptCore. Anything that isn't supported natively needs to be transformed down to a subset of JS that JavaScriptCore supports, and React Native uses Babel to do that. Here are the transformations that React Native uses (as of 2015-07-31):
ES5
ES6
ES7
It is not immediately clear to me why constants aren't included in this list, and it appears that support for overriding it still isn't quite ready:
https://github.com/facebook/react-native/issues/1451
Upvotes: 3
Reputation: 4033
At the moment const
keyword is not supported in react-native android, I hope it will be available with the next release of react-native. The fix was trivial, for more details look into origin github issue.
Upvotes: 0