语法'nullishCoalescingOperator'当前未启用

Mah*_* Fa 16 syntax-error ios react-native react-native-ios

当我试图在ios-simulator上构建我的应用程序时,它说:

捆绑失败:SyntaxError:/Users/MyName/MyApp/node_modules/react-native/node_modules/react-native/Libraries/Components/Switch/Switch.js:nullishCoalescingOperator目前尚未启用对实验语法的支持(167:52):

 165 |         {...props}
  166 |         {...platformProps}
> 167 |         accessibilityRole={props.accessibilityRole ?? 'button'}
      |                                                    ^
  168 |         onChange={this._handleChange}
  169 |         onResponderTerminationRequest={returnsFalse}
  170 |         onStartShouldSetResponder={returnsTrue}
Run Code Online (Sandbox Code Playgroud)

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

我做了它说的,但它没有帮助...任何帮助将不胜感激.

Mah*_* Fa 28

我认为它通过将我的.babelrc更改为

{
  "presets": ["module:metro-react-native-babel-preset"]
}
Run Code Online (Sandbox Code Playgroud)

此更改是由升级我的react-native版本引起的