react-native-searchable-dropdown
Advanced tools
Comparing version 1.0.2 to 1.0.3
26
index.js
@@ -35,3 +35,3 @@ import React, { Component } from 'react'; | ||
} | ||
static getDerivedStateFromProps (props, store) { | ||
@@ -60,5 +60,9 @@ let listItems = props.items ? props.items : [ { id: 0, 'name': '' } ]; | ||
this.setState({listItems: ac, item: item }); | ||
setTimeout(() => { | ||
this.props.onTextChange(searchedText); | ||
}, 0); | ||
const onTextChange = this.props.onTextChange; | ||
if (onTextChange && typeof onTextChange === 'function') { | ||
setTimeout(() => { | ||
onTextChange(searchedText); | ||
}, 0); | ||
} | ||
}; | ||
@@ -85,4 +89,11 @@ | ||
underlineColorAndroid={this.props.underlineColorAndroid} | ||
onFocus={() => { | ||
this.setState({ focus: true, item: { name: '', id: 0 } }) | ||
onFocus={() => { | ||
this.setState({ | ||
focus: true, | ||
item: { | ||
name: '', | ||
id: 0 | ||
}, | ||
listItems: this.props.items | ||
}); | ||
}} | ||
@@ -93,3 +104,3 @@ onBlur={() => { | ||
ref={(e) => this.input = e} | ||
onChangeText={(text) => { | ||
onChangeText={(text) => { | ||
this.searchedItems(text)} | ||
@@ -105,2 +116,1 @@ } | ||
} | ||
{ | ||
"name": "react-native-searchable-dropdown", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Searchable Dropdown", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6461
103