From f77185f27e6cf1f32aceeaf439080402eee5dfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81azowik?= Date: Wed, 5 Oct 2016 04:41:32 -0700 Subject: [PATCH] Fix rest operator syntax errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: These are caused by new [syntax checking](https://github.com/babel/babylon/blob/1285131e3eb28ab6f5f62a7c5fd3ffd7ce1e5eb8/CHANGELOG.md#v6113-2016-10-01) introduced by babylon. "The single rest at the end only applies to binding `let { x, ...y } = obj;` and assignment `({ x, ...y } = obj).`" I'd say this really should be cherry picked into the stable branch. **Test plan** 1. install babylon@6.11.3 2. see that things break 3. apply patch 4. things work 5. make sure all instances were fixed (I used `\.\.\..*,.*\n.*=` in IntelliJ regex format—find all ... followed by newline followed by =) Issue #10199 Closes https://github.com/facebook/react-native/pull/10200 Differential Revision: D3974066 Pulled By: javache fbshipit-source-id: 3f3c1e9df01a3b3bdd61dd3863416c638d3ed98d --- Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js | 2 +- Libraries/CustomComponents/ListView/ListView.js | 2 +- .../CustomComponents/NavigationExperimental/NavigationCard.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js index f78ae86a93..472a2cc0ff 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js @@ -108,7 +108,7 @@ function arrayContains(array: Array, value: T): boolean { function createErrorFromErrorData(errorData: {message: string}): Error { const { message, - ...extraErrorInfo, + ...extraErrorInfo } = errorData; const error = new Error(message); (error:any).framesToPop = 1; diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 2b75380acb..04e336dc4c 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -454,7 +454,7 @@ var ListView = React.createClass({ var { renderScrollComponent, - ...props, + ...props } = this.props; if (!props.scrollEventThrottle) { props.scrollEventThrottle = DEFAULT_SCROLL_CALLBACK_THROTTLE; diff --git a/Libraries/CustomComponents/NavigationExperimental/NavigationCard.js b/Libraries/CustomComponents/NavigationExperimental/NavigationCard.js index ba66351e13..887123fbcc 100644 --- a/Libraries/CustomComponents/NavigationExperimental/NavigationCard.js +++ b/Libraries/CustomComponents/NavigationExperimental/NavigationCard.js @@ -82,7 +82,7 @@ class NavigationCard extends React.Component { pointerEvents, renderScene, style, - ...props, /* NavigationSceneRendererProps */ + ...props /* NavigationSceneRendererProps */ } = this.props; const viewStyle = style === undefined ?