After @Fomahaut's answer, I keep looking for the GitHub Facebook repository and found this problem: https://github.com/facebook/react-native/issues/2182
- Create a .babelrc file in the project root directory
- Add More Rules to Babel
Example:
{ "retainLines": true, "compact": true, "comments": false, "whitelist": [ "es6.arrowFunctions", "es6.blockScoping", "es6.classes", "es6.constants", "es6.destructuring", "es6.forOf", "es6.modules", "es6.parameters", "es6.properties.computed", "es6.properties.shorthand", "es6.spread", "es6.tailCall", "es6.templateLiterals", "es6.regex.unicode", "es6.regex.sticky", "es7.asyncFunctions", "es7.classProperties", "es7.comprehensions", "es7.decorators", "es7.exponentiationOperator", "es7.exportExtensions", "es7.functionBind", "es7.objectRestSpread", "es7.trailingFunctionCommas", "regenerator", "flow", "react", "react.displayName" ], "sourceMaps": false }
source share