react-native-search-filter
react-native-search-filter copied to clipboard
Clear icon does no clear text
Hi, if I add a clear icon, when I press it doesn't clear the text. I am testing with expo in IOS simulator
<SearchInput onChangeText={(term) => { this.searchUpdated(term) }} style={styles.searchInput} placeholder="Search" clearIcon={<Icon name='times' type='font-awesome' />} /> <ScrollView> {filteredProducts.map(product => { return ( <TouchableOpacity onPress={()=>alert(product.name)} key={product.slug} style={styles.productItem}> <View> <Text>{product.name}</Text> </View> </TouchableOpacity> ) })} </ScrollView>
Hi, @PaddyLock Let you use
<SearchInput
onChangeText={this.searchUpdated}
style={styles.searchInput}
placeholder="Search"
value={this.state.value}
clearIcon={}
/>
Updating state fixes issue for me
@osdnk Yes that worked to add
value={this.state.value}
Is this a bug as 'value' is undocumented?
Yes. It's a hacky workaround