Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

syntax 'nullishCoalescingOperator' isn't currently enabled

Tags:

when I tried to build my app on ios-simulator it says :

bundling failed: SyntaxError: /Users/MyName/MyApp/node_modules/react-native/node_modules/react-native/Libraries/Components/Switch/Switch.js: Support for the experimental syntax nullishCoalescingOperator isn't currently enabled (167:52):

 165 |         {...props}   166 |         {...platformProps} > 167 |         accessibilityRole={props.accessibilityRole ?? 'button'}       |                                                    ^   168 |         onChange={this._handleChange}   169 |         onResponderTerminationRequest={returnsFalse}   170 |         onStartShouldSetResponder={returnsTrue} 

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.

I did what it says, but it just didn't help... Any help will be appreciated.

like image 975
Mahgol Fa Avatar asked Dec 27 '18 11:12

Mahgol Fa


1 Answers

I think it resolved by changing my .babelrc to

{   "presets": ["module:metro-react-native-babel-preset"] } 

this change is caused by upgrading my react-native version

like image 192
Mahgol Fa Avatar answered Sep 28 '22 07:09

Mahgol Fa