react-native-search-filter icon indicating copy to clipboard operation
react-native-search-filter copied to clipboard

Clear icon does no clear text

Open PaddyLock opened this issue 7 years ago • 3 comments

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>

PaddyLock avatar Jul 13 '18 10:07 PaddyLock

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 avatar Nov 06 '18 11:11 osdnk

@osdnk Yes that worked to add

value={this.state.value}

Is this a bug as 'value' is undocumented?

PaddyLock avatar Dec 19 '18 15:12 PaddyLock

Yes. It's a hacky workaround

osdnk avatar Dec 19 '18 15:12 osdnk