react-native-sectioned-multi-select
Advanced tools
Comparing version 0.4.6 to 0.4.7
# Changelog | ||
## 0.4.7 - 2018-05-07 | ||
### Changed | ||
- Removed lodash dependency: replaced get and reject functions with internal functions. | ||
@@ -3,0 +6,0 @@ ## 0.4.4 - 2018-04-13 |
@@ -354,2 +354,3 @@ import React, { Component } from 'react' | ||
}) | ||
console.log(this.state.selectedItems); | ||
} | ||
@@ -403,5 +404,5 @@ onSelectedItemObjectsChange = (selectedItemObjects) => { | ||
handleAddSearchTerm = () => { | ||
const searchTerm = this.SectionedMultiSelect._getSearchTerm(); | ||
const id = items[items.length - 1].id + 1; | ||
if ( searchTerm.length && !items.some( item => item.title.includes(searchTerm) ) ) { | ||
const searchTerm = this.SectionedMultiSelect._getSearchTerm(); | ||
const id = this.state.items[this.state.items.length - 1].id + 1; | ||
if ( searchTerm.length && !this.state.items.some( item => item.title.includes(searchTerm) ) ) { | ||
const newItem = {id: id, title: searchTerm}; | ||
@@ -408,0 +409,0 @@ this.setState(prevState => ({items: [...prevState.items, newItem]})); |
@@ -12,3 +12,3 @@ { | ||
"react-native": "0.50.3", | ||
"react-native-sectioned-multi-select": "^0.4.4", | ||
"react-native-sectioned-multi-select": "git://github.com/renrizzolo/react-native-sectioned-multi-select#master", | ||
"react-native-vector-icons": "^4.4.2" | ||
@@ -15,0 +15,0 @@ }, |
@@ -19,4 +19,4 @@ import React, { PureComponent } from 'react' | ||
} from 'react-native' | ||
import get from 'lodash/get' | ||
import reject from 'lodash/reject' | ||
// import get from 'lodash/get' | ||
// import reject from 'lodash/reject' | ||
import Icon from 'react-native-vector-icons/MaterialIcons' | ||
@@ -225,6 +225,9 @@ | ||
componentWillUpdate() { date = new Date();} | ||
// componentWillUpdate() { date = new Date();} | ||
// componentDidUpdate() {console.log(new Date().valueOf() - date.valueOf())} | ||
getProp = (object, key) => object && object[key] | ||
rejectProp = (items, fn) => items.filter(fn) | ||
find = (id, items) => { | ||
@@ -278,3 +281,3 @@ if (!items) { | ||
const foundItem = this._findItem(item) | ||
return get(foundItem, displayKey) || selectText | ||
return this.getProp(foundItem, displayKey) || selectText | ||
} | ||
@@ -298,3 +301,3 @@ return `${selectText} (${selectedItems.length} ${selectedText})` | ||
const regex = new RegExp(`(${parts.join('|')})`, 'i') | ||
if (regex.test(get(item, displayKey))) { | ||
if (regex.test(this.getProp(item, displayKey))) { | ||
filteredItems.push(item) | ||
@@ -306,6 +309,6 @@ } | ||
item[subKey].forEach((sub) => { | ||
if (regex.test(get(sub, displayKey))) { | ||
if (regex.test(this.getProp(sub, displayKey))) { | ||
newItem[subKey] = [...newItem[subKey], sub] | ||
newFilteredItems = reject(filteredItems, singleItem => | ||
item[uniqueKey] === singleItem[uniqueKey]) | ||
newFilteredItems = this.rejectProp(filteredItems, singleItem => | ||
item[uniqueKey] !== singleItem[uniqueKey]) | ||
newFilteredItems.push(newItem) | ||
@@ -330,4 +333,4 @@ filteredItems = newFilteredItems | ||
const newItems = reject(selectedItems, singleItem => ( | ||
item[uniqueKey] === singleItem | ||
const newItems = this.rejectProp(selectedItems, singleItem => ( | ||
item[uniqueKey] !== singleItem | ||
)) | ||
@@ -429,18 +432,18 @@ | ||
newItems = reject(newItems, singleItem => ( | ||
item[uniqueKey] === singleItem | ||
newItems = this.rejectProp(newItems, singleItem => ( | ||
item[uniqueKey] !== singleItem | ||
)) | ||
} else if (highlightChildren) { | ||
this._unHighlightChildren(item[uniqueKey]) | ||
newItems = reject(selectedItems, singleItem => ( | ||
item[uniqueKey] === singleItem | ||
newItems = this.rejectProp(selectedItems, singleItem => ( | ||
item[uniqueKey] !== singleItem | ||
)) | ||
} else { | ||
newItems = reject(selectedItems, singleItem => ( | ||
item[uniqueKey] === singleItem | ||
newItems = this.rejectProp(selectedItems, singleItem => ( | ||
item[uniqueKey] !== singleItem | ||
)) | ||
} | ||
} else { | ||
newItems = reject(selectedItems, singleItem => ( | ||
item[uniqueKey] === singleItem | ||
newItems = this.rejectProp(selectedItems, singleItem => ( | ||
item[uniqueKey] !== singleItem | ||
)) | ||
@@ -447,0 +450,0 @@ } |
{ | ||
"name": "react-native-sectioned-multi-select", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "a multi (or single) select component with support for sub categories, search, chips.", | ||
@@ -21,3 +21,2 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"lodash": "^4.17.4", | ||
"prop-types": "^15.6.0", | ||
@@ -24,0 +23,0 @@ "react-native-vector-icons": "^4.1.1" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3003405
2
1728
1