react-native-searchable-dropdown
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -8,2 +8,5 @@ [npm-badge]: https://img.shields.io/npm/v/react-native-searchable-dropdown.svg?colorB=ff6d00 | ||
# 1.1.1 | ||
* bud removed of text changes props | ||
# 1.0.9 | ||
@@ -10,0 +13,0 @@ * multi selection added |
33
index.js
@@ -18,2 +18,7 @@ import React, { Component } from 'react'; | ||
super(props); | ||
this.renderTextInput = this.renderTextInput.bind(this); | ||
this.renderFlatList = this.renderFlatList.bind(this); | ||
this.searchedItems = this.searchedItems.bind(this); | ||
this.renderItems = this.renderItems.bind(this); | ||
this.state = { | ||
@@ -40,2 +45,6 @@ item: {}, | ||
flatListPorps[kv.key] = kv.val; | ||
} else { | ||
if(kv.key === 'style') { | ||
flatListPorps['style'] = kv.val; | ||
} | ||
} | ||
@@ -54,3 +63,2 @@ }); | ||
const defaultIndex = this.props.defaultIndex; | ||
if (defaultIndex && listItems.length > defaultIndex) { | ||
@@ -69,3 +77,5 @@ this.setState({ | ||
if (!setSort && typeof setSort !== 'function') { | ||
setSort = item => item.name.toLowerCase().indexOf(searchedText.toLowerCase()) > -1; | ||
setSort = (item, searchedText) => { | ||
return item.name.toLowerCase().indexOf(searchedText.toLowerCase()) > -1 | ||
}; | ||
} | ||
@@ -80,4 +90,3 @@ var ac = this.props.items.filter((item) => { | ||
this.setState({ listItems: ac, item: item }); | ||
const onTextChange = this.props.onTextChange; | ||
const onTextChange = this.props.onTextChange || this.props.textInputProps.onTextChange || this.props.onChangeText || this.props.textInputProps.onChangeText; | ||
if (onTextChange && typeof onTextChange === 'function') { | ||
@@ -152,3 +161,3 @@ setTimeout(() => { | ||
renderTextInput = () => { | ||
const textInputPorps = { ...this.props.textInputProps }; | ||
const textInputProps = { ...this.props.textInputProps }; | ||
const oldSupport = [ | ||
@@ -194,4 +203,12 @@ { key: 'ref', val: e => (this.input = e) }, | ||
oldSupport.forEach((kv) => { | ||
if(!Object.keys(textInputPorps).includes(kv.key)) { | ||
textInputPorps[kv.key] = kv.val; | ||
if(!Object.keys(textInputProps).includes(kv.key)) { | ||
if(kv.key === 'onTextChange' || kv.key === 'onChangeText') { | ||
textInputProps['onChangeText'] = kv.val; | ||
} else { | ||
textInputProps[kv.key] = kv.val; | ||
} | ||
} else { | ||
if(kv.key === 'onTextChange' || kv.key === 'onChangeText') { | ||
textInputProps['onChangeText'] = kv.val; | ||
} | ||
} | ||
@@ -201,3 +218,3 @@ }); | ||
<TextInput | ||
{ ...textInputPorps } | ||
{ ...textInputProps } | ||
/> | ||
@@ -204,0 +221,0 @@ ) |
{ | ||
"name": "react-native-searchable-dropdown", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Searchable Dropdown", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
17100
245