From efc9506a8ec502d15d58e0a9de2b4cfec7845e7a Mon Sep 17 00:00:00 2001 From: Fernando Ruiz Date: Thu, 1 Nov 2018 17:10:53 -0700 Subject: [PATCH] Modified declarations from vars to const (#22070) Summary: Replaces the keywords `var` with `const` in `Libraries/Lists/ListView/ListViewDataSource.js` Pull Request resolved: https://github.com/facebook/react-native/pull/22070 Differential Revision: D12895068 Pulled By: TheSavior fbshipit-source-id: f191158396a0f03bb78942a57b08ec96348a9b32 --- Libraries/Lists/ListView/ListViewDataSource.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/Lists/ListView/ListViewDataSource.js b/Libraries/Lists/ListView/ListViewDataSource.js index 5945ddb4cac..3435d6153a0 100644 --- a/Libraries/Lists/ListView/ListViewDataSource.js +++ b/Libraries/Lists/ListView/ListViewDataSource.js @@ -62,7 +62,7 @@ type ParamType = { * * ``` * getInitialState: function() { - * var ds = new ListView.DataSource({rowHasChanged: this._rowHasChanged}); + * const ds = new ListView.DataSource({rowHasChanged: this._rowHasChanged}); * return {ds}; * }, * _onDataArrived(newData) { @@ -356,7 +356,7 @@ class ListViewDataSource { const prevSectionsHash = keyedDictionaryFromArray(prevSectionIDs); const prevRowsHash = {}; for (let ii = 0; ii < prevRowIDs.length; ii++) { - var sectionID = prevSectionIDs[ii]; + const sectionID = prevSectionIDs[ii]; warning( !prevRowsHash[sectionID], 'SectionID appears more than once: ' + sectionID, @@ -370,7 +370,7 @@ class ListViewDataSource { let dirty; for (let sIndex = 0; sIndex < this.sectionIdentities.length; sIndex++) { - var sectionID = this.sectionIdentities[sIndex]; + const sectionID = this.sectionIdentities[sIndex]; // dirty if the sectionHeader is new or _sectionHasChanged is true dirty = !prevSectionsHash[sectionID]; const sectionHeaderHasChanged = this._sectionHeaderHasChanged;