Merge pull request #57 from andersonaddo/master

Addressing deep copying issue #56
This commit is contained in:
Saleel
2018-07-22 22:34:12 +04:00
committed by GitHub
3 changed files with 10 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { View, Dimensions, ViewPropTypes, SectionList } from 'react-native';
import { chunkArray } from './utils';
import cloneDeep from 'lodash/cloneDeep';
/**
* This class is a modification on the main super grid class. It renders a vertical scrolling grid SectionList
@@ -110,7 +111,7 @@ class SuperGridSectionList extends Component {
const { itemsPerRow } = this.state;
//Deep copy, so that re-renders and chunkArray functions don't affect the actual items object
let sectionsCopy = JSON.parse(JSON.stringify(sections));
let sectionsCopy = cloneDeep(sections);
for (sectionsPair of sectionsCopy){

15
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "react-native-super-grid",
"version": "1.1.0",
"version": "2.3.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -475,7 +475,7 @@
"js-yaml": "3.10.0",
"json-stable-stringify": "1.0.1",
"levn": "0.3.0",
"lodash": "4.17.4",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"natural-compare": "1.4.0",
"optionator": "0.8.2",
@@ -871,7 +871,7 @@
"cli-cursor": "1.0.2",
"cli-width": "2.2.0",
"figures": "1.7.0",
"lodash": "4.17.4",
"lodash": "4.17.10",
"readline2": "1.0.1",
"run-async": "0.1.0",
"rx-lite": "3.1.2",
@@ -1091,10 +1091,9 @@
}
},
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
"dev": true
"version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
},
"lodash.cond": {
"version": "4.5.2",
@@ -1611,7 +1610,7 @@
"ajv": "4.11.8",
"ajv-keywords": "1.5.1",
"chalk": "1.1.3",
"lodash": "4.17.4",
"lodash": "4.17.10",
"slice-ansi": "0.0.4",
"string-width": "2.1.1"
},

View File

@@ -35,6 +35,7 @@
"eslint-plugin-react": "^6.10.3"
},
"dependencies": {
"lodash": "^4.17.10",
"prop-types": "^15.6.0"
}
}