Socket
Socket
Sign inDemoInstall

react-native-searchable-dropdown

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

CHANGELOG.md

21

index.js
import React, { Component } from 'react';
import {
StyleSheet,
Text,
ListView,
FlatList,
TextInput,

@@ -36,2 +36,15 @@ View,

renderFlatList(){
if(this.state.focus){
return (
<FlatList
style={{ ...this.props.itemsContainerStyle }}
keyboardShouldPersistTaps="always"
data={this.state.listItems}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => this.renderItems(item)} />
)
}
}
componentDidMount(){

@@ -83,2 +96,6 @@ const listItems = this.props.items;

renderListType(){
return this.props.listType == 'ListView' ? this.renderList() : this.renderFlatList();
}
render() {

@@ -110,3 +127,3 @@ return (

placeholder={this.props.placeholder} />
{ this.renderList() }
{ this.renderListType() }
</View>

@@ -113,0 +130,0 @@ );

6

package.json
{
"name": "react-native-searchable-dropdown",
"version": "1.0.5",
"version": "1.0.6",
"description": "Searchable Dropdown",

@@ -21,3 +21,5 @@ "main": "index.js",

"react-native-searchable-dropdown",
"react searchable dropdown"
"react searchable dropdown",
"react searchable list",
"react auto search dropdown"
],

@@ -24,0 +26,0 @@ "author": "Zubair Ibrahim <zubair.paizer11@gmail.com.com>",

@@ -10,3 +10,3 @@ [example-url]: https://i.imgur.com/mHGaOX5.gif

# React Native Searchable Dropdown
Searchable Dropdown help you to search with in the dropdown. and you can pick single item.
Searchable Dropdown to help you search with in the list (using `ListView` and `FlatList`), and you can pick single item.

@@ -74,82 +74,83 @@ ![example][example-url]

</tr>
<tr>
<tr>
<td>underlineColorAndroid</td>
<td>TextInput underline height</td>
</tr>
<tr>
<td>listType</td>
<td>default will be FlatList or you can pass ListView</td>
</tr>
</table>
# Example
```javascript
```jsx
import React, { Component } from 'react';
import SearchableDropdown from 'react-native-searchable-dropdown';
import SearchableDropdown from 'react-native-searchable-dropdown';
var items = [
{
id: 1,
name: 'Javascript'
},
{
id: 2,
name: 'Java'
},
{
id: 3,
name: 'Ruby'
},
{
id: 4,
name: 'React Native'
},
{
id: 5,
name: 'PHP'
},
{
id: 6,
name: 'Python'
},
{
id: 7,
name: 'Go'
},
{
id: 8,
name: 'Swift'
},
var items = [
{
id: 1,
name: 'JavaScript',
},
{
id: 2,
name: 'Java',
},
{
id: 3,
name: 'Ruby',
},
{
id: 4,
name: 'React Native',
},
{
id: 5,
name: 'PHP',
},
{
id: 6,
name: 'Python',
},
{
id: 7,
name: 'Go',
},
{
id: 8,
name: 'Swift',
},
];
class Example extends Component {
render() {
<SearchableDropDown
onTextChange={(text) => alert(text)}
onItemSelect={(item) => alert(JSON.stringify(item))}
containerStyle={{
padding: 5
}}
textInputStyle={{
padding: 12,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 5
}}
itemStyle={{
padding: 10,
marginTop: 2,
backgroundColor: '#ddd',
borderColor: '#bbb',
borderWidth: 1,
borderRadius:5
}}
itemTextStyle={{
color: '#222'
}}
itemsContainerStyle={{
maxHeight: 140
}}
items={items}
defaultIndex={2}
placeholder="Placeholder."
resetValue={false}
underlineColorAndroid='transparent' />
}
render() {
return (
<SearchableDropdown
onTextChange={text => alert(text)}
onItemSelect={item => alert(JSON.stringify(item))}
containerStyle={{ padding: 5 }}
textInputStyle={{
padding: 12,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 5,
}}
itemStyle={{
padding: 10,
marginTop: 2,
backgroundColor: '#ddd',
borderColor: '#bbb',
borderWidth: 1,
borderRadius: 5,
}}
itemTextStyle={{ color: '#222' }}
itemsContainerStyle={{ maxHeight: 140 }}
items={items}
defaultIndex={2}
placeholder="placeholder"
resetValue={false}
underlineColorAndroid="transparent"
/>
);
}
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc