Installations
npm install react-native-element-dropdown-updated
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.12.1
NPM Version
8.19.2
Score
45.4
Supply Chain
59.9
Quality
65.5
Maintenance
50
Vulnerability
93.8
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (97.13%)
JavaScript (2.87%)
Developer
hoaphantn7604
Download Statistics
Total Downloads
304
Last Day
1
Last Week
3
Last Month
8
Last Year
65
GitHub Statistics
1,082 Stars
328 Commits
181 Forks
4 Watching
1 Branches
2 Contributors
Bundle Size
19.55 kB
Minified
5.35 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
react-native-element-dropdown-updated@1.0.1
Unpacked Size
415.11 kB
Size
79.85 kB
File Count
105
NPM Version
8.19.2
Node Version
18.12.1
Publised On
24 Feb 2023
Total Downloads
Cumulative downloads
Total Downloads
304
Last day
-50%
1
Compared to previous day
Last week
50%
3
Compared to previous week
Last month
-20%
8
Compared to previous month
Last year
-72.8%
65
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
3
Dev Dependencies
20
react-native-element-dropdown
A React Native dropdown component easy to customize for both iOS and Android.
Features
- Dropdown and Multiselect in one package
- Easy to use
- Consistent look and feel on iOS and Android
- Customizable font size, colors and animation duration
- Implemented with typescript
Getting started
1 npm install react-native-element-dropdown --save
or
1 yarn add react-native-element-dropdown
Video tutorial
Source code demo
react-native-template-components A beautiful template for React Native.
Demo
Dropdown Props
Props | Params | isRequire | Description |
---|---|---|---|
data | Array | Yes | Data is a plain array |
labelField | String | Yes | Extract the label from the data item |
valueField | String | Yes | Extract the primary key from the data item |
onChange | (item: object) => void | Yes | Selection callback |
onChangeText | (search: string) => void | Yes | Callback that is called when the text input's text changes |
value | Item | No | Selected value |
placeholder | String | No | The string that will be rendered before dropdown has been selected |
placeholderStyle | TextStyle | No | Styling for text placeholder |
selectedTextStyle | TextStyle | No | Styling for selected text |
selectedTextProps | TextProps | No | Text Props for selected text. Ex: numberOfLines={1} |
style | ViewStyle | No | Styling for container view |
containerStyle | ViewStyle | No | Styling for container list |
maxHeight | Number | No | Customize height for container list |
fontFamily | String | No | Customize font style |
iconStyle | ImageStyle | No | Styling for icon |
iconColor | String | No | Color of icons |
itemContainerStyle | TextStyle | No | Styling for item container in list |
itemTextStyle | TextStyle | No | Styling for text item in list |
activeColor | String | No | Background color for item selected in container list |
search | Boolean | No | Show or hide input search |
searchQuery | (keyword: string, labelValue: string) => Boolean | No | Callback used to filter the list of items |
inputSearchStyle | ViewStyle | No | Styling for input search |
searchPlaceholder | String | No | The string that will be rendered before text input has been entered |
renderInputSearch | (onSearch: (text:string) => void) => JSX.Element | No | Customize TextInput search |
disable | Boolean | No | Specifies the disabled state of the Dropdown |
dropdownPosition | 'auto' or 'top' or 'bottom' | No | Dropdown list position. Default is 'auto' |
autoScroll | Boolean | No | Auto scroll to index item selected, default is true |
showsVerticalScrollIndicator | Boolean | No | When true, shows a vertical scroll indicator, default is true |
renderLeftIcon | (visible?: boolean) => JSX.Element | No | Customize left icon for dropdown |
renderRightIcon | (visible?: boolean) => JSX.Element | No | Customize right icon for dropdown |
renderItem | (item: object, selected: Boolean) => JSX.Element | No | Takes an item from data and renders it into the list |
flatListProps | FlatListProps | No | Customize FlastList element |
onFocus | () => void | No | Callback that is called when the dropdown is focused |
onBlur | () => void | No | Callback that is called when the dropdown is blurred |
keyboardAvoiding | Boolean | No | keyboardAvoiding default is true |
backgroundColor | String | No | Set background color |
statusBarIsTranslucent | Boolean | No | Only Android, set true when StatusBar set Translucent is true |
confirmSelectItem | Boolean | No | Turn On confirm select item. Refer example/src/dropdown/example3 |
onConfirmSelectItem | (item: object) => void | No | Selection callback. Refer example/src/dropdown/example3 |
testID | String | No | Used to locate this view in end-to-end tests |
itemTestIDField | String | No | Add this field to the input data. Ex: DATA = [{itemTestIDField: '', label: '', value:: ''}] |
accessibilityLabel | String | No | Set an accessibilityLabel on the view, so that people who use VoiceOver know what element they have selected |
itemAccessibilityLabelField | String | No | Add this field to the input data. Ex: DATA = [{itemAccessibilityLabelField: '', label: '', value:: ''}] |
MultiSelect Props
Props | Params | isRequire | Description |
---|---|---|---|
data | Array | Yes | Data is a plain array |
labelField | String | Yes | Extract the label from the data item |
valueField | String | Yes | Extract the primary key from the data item |
onChange | (value[]) => void | Yes | Selection callback. A array containing the "valueField". |
onChangeText | (search: string) => void | Yes | Callback that is called when the text input's text changes |
value | Item[] | No | Selected value. A array containing the "valueField". |
placeholder | String | No | The string that will be rendered before dropdown has been selected |
placeholderStyle | TextStyle | No | Styling for text placeholder |
style | ViewStyle | No | Styling for container view |
containerStyle | ViewStyle | No | Styling for container list |
maxHeight | Number | No | Customize height for container list |
maxSelect | Number | No | maximum number of items that can be selected |
fontFamily | String | No | Customize font style |
iconStyle | ImageStyle | No | Styling for icon |
iconColor | String | No | Color of icons |
activeColor | String | No | Background color for item selected in container list |
itemContainerStyle | TextStyle | No | Styling for item container in list |
itemTextStyle | TextStyle | No | Styling for text item in list |
selectedStyle | ViewStyle | No | Styling for selected view |
selectedTextStyle | TextStyle | No | Styling for selected text |
renderSelectedItem | (item: object, unSelect?: () => void) => JSX.Element | No | Takes an item from data and renders it into the list selected |
alwaysRenderSelectedItem | Boolean | No | Always show the list of selected items |
visibleSelectedItem | Boolean | No | Option to hide selected item list, Ẽx: visibleSelectedItem={false} |
search | Boolean | No | Show or hide input search |
searchQuery | (keyword: string, labelValue: string) => Boolean | No | Callback used to filter the list of items |
inputSearchStyle | ViewStyle | No | Styling for input search |
searchPlaceholder | String | No | The string that will be rendered before text input has been entered |
renderInputSearch | (onSearch: (text:string) => void) => JSX.Element | No | Customize TextInput search |
disable | Boolean | No | Specifies the disabled state of the Dropdown |
dropdownPosition | 'auto' or 'top' or 'bottom' | No | Dropdown list position. Default is 'auto' |
showsVerticalScrollIndicator | Boolean | No | When true, shows a vertical scroll indicator, default is true |
renderLeftIcon | (visible?: boolean) => JSX.Element | No | Customize left icon for dropdown |
renderRightIcon | (visible?: boolean) => JSX.Element | No | Customize right icon for dropdown |
renderItem | (item: object, selected: Boolean) => JSX.Element | No | Takes an item from data and renders it into the list |
flatListProps | FlatListProps | No | Customize FlastList element |
onFocus | () => void | No | Callback that is called when the dropdown is focused |
onBlur | () => void | No | Callback that is called when the dropdown is blurred |
keyboardAvoiding | Boolean | No | keyboardAvoiding default is true |
inside | Boolean | No | inside default is false |
backgroundColor | String | No | Set background color |
statusBarIsTranslucent | Boolean | No | Only Android, set true when StatusBar set Translucent is true |
confirmSelectItem | Boolean | No | Turn On confirm select item. Refer example/src/dropdown/example7 |
confirmUnSelectItem | Boolean | No | Turn On confirm un-select item. Refer example/src/dropdown/example7 |
onConfirmSelectItem | (item: any) => void | No | Selection callback. Refer example/src/dropdown/example7 |
testID | String | No | Used to locate this view in end-to-end tests |
itemTestIDField | String | No | Add this field to the input data. Ex: DATA = [{itemTestIDField: '', label: '', value:: ''}] |
accessibilityLabel | String | No | Set an accessibilityLabel on the view, so that people who use VoiceOver know what element they have selected |
itemAccessibilityLabelField | String | No | Add this field to the input data. Ex: DATA = [{itemAccessibilityLabelField: '', label: '', value:: ''}] |
SelectCountry extends Dropdown
Props | Params | isRequire | Description |
---|---|---|---|
imageField | String | Yes | Extract the image from the data item |
imageStyle | ImageStyle | No | Styling for image |
Method
API | Params | Description |
---|---|---|
open | () => void | Open dropdown list |
close | () => void | Close dropdown list |
Dropdown example
1 import React, { useState } from 'react'; 2 import { StyleSheet, Text, View } from 'react-native'; 3 import { Dropdown } from 'react-native-element-dropdown'; 4 import AntDesign from 'react-native-vector-icons/AntDesign'; 5 6 const data = [ 7 { label: 'Item 1', value: '1' }, 8 { label: 'Item 2', value: '2' }, 9 { label: 'Item 3', value: '3' }, 10 { label: 'Item 4', value: '4' }, 11 { label: 'Item 5', value: '5' }, 12 { label: 'Item 6', value: '6' }, 13 { label: 'Item 7', value: '7' }, 14 { label: 'Item 8', value: '8' }, 15 ]; 16 17 const DropdownComponent = () => { 18 const [value, setValue] = useState(null); 19 const [isFocus, setIsFocus] = useState(false); 20 21 const renderLabel = () => { 22 if (value || isFocus) { 23 return ( 24 <Text style={[styles.label, isFocus && { color: 'blue' }]}> 25 Dropdown label 26 </Text> 27 ); 28 } 29 return null; 30 }; 31 32 return ( 33 <View style={styles.container}> 34 {renderLabel()} 35 <Dropdown 36 style={[styles.dropdown, isFocus && { borderColor: 'blue' }]} 37 placeholderStyle={styles.placeholderStyle} 38 selectedTextStyle={styles.selectedTextStyle} 39 inputSearchStyle={styles.inputSearchStyle} 40 iconStyle={styles.iconStyle} 41 data={data} 42 search 43 maxHeight={300} 44 labelField="label" 45 valueField="value" 46 placeholder={!isFocus ? 'Select item' : '...'} 47 searchPlaceholder="Search..." 48 value={value} 49 onFocus={() => setIsFocus(true)} 50 onBlur={() => setIsFocus(false)} 51 onChange={item => { 52 setValue(item.value); 53 setIsFocus(false); 54 }} 55 renderLeftIcon={() => ( 56 <AntDesign 57 style={styles.icon} 58 color={isFocus ? 'blue' : 'black'} 59 name="Safety" 60 size={20} 61 /> 62 )} 63 /> 64 </View> 65 ); 66 }; 67 68 export default DropdownComponent; 69 70 const styles = StyleSheet.create({ 71 container: { 72 backgroundColor: 'white', 73 padding: 16, 74 }, 75 dropdown: { 76 height: 50, 77 borderColor: 'gray', 78 borderWidth: 0.5, 79 borderRadius: 8, 80 paddingHorizontal: 8, 81 }, 82 icon: { 83 marginRight: 5, 84 }, 85 label: { 86 position: 'absolute', 87 backgroundColor: 'white', 88 left: 22, 89 top: 8, 90 zIndex: 999, 91 paddingHorizontal: 8, 92 fontSize: 14, 93 }, 94 placeholderStyle: { 95 fontSize: 16, 96 }, 97 selectedTextStyle: { 98 fontSize: 16, 99 }, 100 iconStyle: { 101 width: 20, 102 height: 20, 103 }, 104 inputSearchStyle: { 105 height: 40, 106 fontSize: 16, 107 }, 108 });
Dropdown example 1
1 import React, { useState } from 'react'; 2 import { StyleSheet } from 'react-native'; 3 import { Dropdown } from 'react-native-element-dropdown'; 4 import AntDesign from 'react-native-vector-icons/AntDesign'; 5 6 const data = [ 7 { label: 'Item 1', value: '1' }, 8 { label: 'Item 2', value: '2' }, 9 { label: 'Item 3', value: '3' }, 10 { label: 'Item 4', value: '4' }, 11 { label: 'Item 5', value: '5' }, 12 { label: 'Item 6', value: '6' }, 13 { label: 'Item 7', value: '7' }, 14 { label: 'Item 8', value: '8' }, 15 ]; 16 17 const DropdownComponent = () => { 18 const [value, setValue] = useState(null); 19 20 return ( 21 <Dropdown 22 style={styles.dropdown} 23 placeholderStyle={styles.placeholderStyle} 24 selectedTextStyle={styles.selectedTextStyle} 25 inputSearchStyle={styles.inputSearchStyle} 26 iconStyle={styles.iconStyle} 27 data={data} 28 search 29 maxHeight={300} 30 labelField="label" 31 valueField="value" 32 placeholder="Select item" 33 searchPlaceholder="Search..." 34 value={value} 35 onChange={item => { 36 setValue(item.value); 37 }} 38 renderLeftIcon={() => ( 39 <AntDesign style={styles.icon} color="black" name="Safety" size={20} /> 40 )} 41 /> 42 ); 43 }; 44 45 export default DropdownComponent; 46 47 const styles = StyleSheet.create({ 48 dropdown: { 49 margin: 16, 50 height: 50, 51 borderBottomColor: 'gray', 52 borderBottomWidth: 0.5, 53 }, 54 icon: { 55 marginRight: 5, 56 }, 57 placeholderStyle: { 58 fontSize: 16, 59 }, 60 selectedTextStyle: { 61 fontSize: 16, 62 }, 63 iconStyle: { 64 width: 20, 65 height: 20, 66 }, 67 inputSearchStyle: { 68 height: 40, 69 fontSize: 16, 70 }, 71 });
Dropdown example 2
1 import React, { useState } from 'react'; 2 import { StyleSheet, View, Text } from 'react-native'; 3 import { Dropdown } from 'react-native-element-dropdown'; 4 import AntDesign from 'react-native-vector-icons/AntDesign'; 5 6 const data = [ 7 { label: 'Item 1', value: '1' }, 8 { label: 'Item 2', value: '2' }, 9 { label: 'Item 3', value: '3' }, 10 { label: 'Item 4', value: '4' }, 11 { label: 'Item 5', value: '5' }, 12 { label: 'Item 6', value: '6' }, 13 { label: 'Item 7', value: '7' }, 14 { label: 'Item 8', value: '8' }, 15 ]; 16 17 const DropdownComponent = () => { 18 const [value, setValue] = useState(null); 19 20 const renderItem = item => { 21 return ( 22 <View style={styles.item}> 23 <Text style={styles.textItem}>{item.label}</Text> 24 {item.value === value && ( 25 <AntDesign 26 style={styles.icon} 27 color="black" 28 name="Safety" 29 size={20} 30 /> 31 )} 32 </View> 33 ); 34 }; 35 36 return ( 37 <Dropdown 38 style={styles.dropdown} 39 placeholderStyle={styles.placeholderStyle} 40 selectedTextStyle={styles.selectedTextStyle} 41 inputSearchStyle={styles.inputSearchStyle} 42 iconStyle={styles.iconStyle} 43 data={data} 44 search 45 maxHeight={300} 46 labelField="label" 47 valueField="value" 48 placeholder="Select item" 49 searchPlaceholder="Search..." 50 value={value} 51 onChange={item => { 52 setValue(item.value); 53 }} 54 renderLeftIcon={() => ( 55 <AntDesign style={styles.icon} color="black" name="Safety" size={20} /> 56 )} 57 renderItem={renderItem} 58 /> 59 ); 60 }; 61 62 export default DropdownComponent; 63 64 const styles = StyleSheet.create({ 65 dropdown: { 66 margin: 16, 67 height: 50, 68 backgroundColor: 'white', 69 borderRadius: 12, 70 padding: 12, 71 shadowColor: '#000', 72 shadowOffset: { 73 width: 0, 74 height: 1, 75 }, 76 shadowOpacity: 0.2, 77 shadowRadius: 1.41, 78 79 elevation: 2, 80 }, 81 icon: { 82 marginRight: 5, 83 }, 84 item: { 85 padding: 17, 86 flexDirection: 'row', 87 justifyContent: 'space-between', 88 alignItems: 'center', 89 }, 90 textItem: { 91 flex: 1, 92 fontSize: 16, 93 }, 94 placeholderStyle: { 95 fontSize: 16, 96 }, 97 selectedTextStyle: { 98 fontSize: 16, 99 }, 100 iconStyle: { 101 width: 20, 102 height: 20, 103 }, 104 inputSearchStyle: { 105 height: 40, 106 fontSize: 16, 107 }, 108 });
MultiSelect example 1
1 import React, { useState } from 'react'; 2 import { StyleSheet, View } from 'react-native'; 3 import { MultiSelect } from 'react-native-element-dropdown'; 4 import AntDesign from 'react-native-vector-icons/AntDesign'; 5 6 const data = [ 7 { label: 'Item 1', value: '1' }, 8 { label: 'Item 2', value: '2' }, 9 { label: 'Item 3', value: '3' }, 10 { label: 'Item 4', value: '4' }, 11 { label: 'Item 5', value: '5' }, 12 { label: 'Item 6', value: '6' }, 13 { label: 'Item 7', value: '7' }, 14 { label: 'Item 8', value: '8' }, 15 ]; 16 17 const MultiSelectComponent = () => { 18 const [selected, setSelected] = useState([]); 19 20 return ( 21 <View style={styles.container}> 22 <MultiSelect 23 style={styles.dropdown} 24 placeholderStyle={styles.placeholderStyle} 25 selectedTextStyle={styles.selectedTextStyle} 26 inputSearchStyle={styles.inputSearchStyle} 27 iconStyle={styles.iconStyle} 28 search 29 data={data} 30 labelField="label" 31 valueField="value" 32 placeholder="Select item" 33 searchPlaceholder="Search..." 34 value={selected} 35 onChange={item => { 36 setSelected(item); 37 }} 38 renderLeftIcon={() => ( 39 <AntDesign 40 style={styles.icon} 41 color="black" 42 name="Safety" 43 size={20} 44 /> 45 )} 46 selectedStyle={styles.selectedStyle} 47 /> 48 </View> 49 ); 50 }; 51 52 export default MultiSelectComponent; 53 54 const styles = StyleSheet.create({ 55 container: { padding: 16 }, 56 dropdown: { 57 height: 50, 58 backgroundColor: 'transparent', 59 borderBottomColor: 'gray', 60 borderBottomWidth: 0.5, 61 }, 62 placeholderStyle: { 63 fontSize: 16, 64 }, 65 selectedTextStyle: { 66 fontSize: 14, 67 }, 68 iconStyle: { 69 width: 20, 70 height: 20, 71 }, 72 inputSearchStyle: { 73 height: 40, 74 fontSize: 16, 75 }, 76 icon: { 77 marginRight: 5, 78 }, 79 selectedStyle: { 80 borderRadius: 12, 81 }, 82 });
MultiSelect example 2
1 import React, { useState } from 'react'; 2 import { StyleSheet, View, TouchableOpacity, Text } from 'react-native'; 3 import { MultiSelect } from 'react-native-element-dropdown'; 4 import AntDesign from 'react-native-vector-icons/AntDesign'; 5 6 const data = [ 7 { label: 'Item 1', value: '1' }, 8 { label: 'Item 2', value: '2' }, 9 { label: 'Item 3', value: '3' }, 10 { label: 'Item 4', value: '4' }, 11 { label: 'Item 5', value: '5' }, 12 { label: 'Item 6', value: '6' }, 13 { label: 'Item 7', value: '7' }, 14 { label: 'Item 8', value: '8' }, 15 ]; 16 17 const MultiSelectComponent = () => { 18 const [selected, setSelected] = useState([]); 19 20 const renderItem = item => { 21 return ( 22 <View style={styles.item}> 23 <Text style={styles.selectedTextStyle}>{item.label}</Text> 24 <AntDesign style={styles.icon} color="black" name="Safety" size={20} /> 25 </View> 26 ); 27 }; 28 29 return ( 30 <View style={styles.container}> 31 <MultiSelect 32 style={styles.dropdown} 33 placeholderStyle={styles.placeholderStyle} 34 selectedTextStyle={styles.selectedTextStyle} 35 inputSearchStyle={styles.inputSearchStyle} 36 iconStyle={styles.iconStyle} 37 data={data} 38 labelField="label" 39 valueField="value" 40 placeholder="Select item" 41 value={selected} 42 search 43 searchPlaceholder="Search..." 44 onChange={item => { 45 setSelected(item); 46 }} 47 renderLeftIcon={() => ( 48 <AntDesign 49 style={styles.icon} 50 color="black" 51 name="Safety" 52 size={20} 53 /> 54 )} 55 renderItem={renderItem} 56 renderSelectedItem={(item, unSelect) => ( 57 <TouchableOpacity onPress={() => unSelect && unSelect(item)}> 58 <View style={styles.selectedStyle}> 59 <Text style={styles.textSelectedStyle}>{item.label}</Text> 60 <AntDesign color="black" name="delete" size={17} /> 61 </View> 62 </TouchableOpacity> 63 )} 64 /> 65 </View> 66 ); 67 }; 68 69 export default MultiSelectComponent; 70 71 const styles = StyleSheet.create({ 72 container: { padding: 16 }, 73 dropdown: { 74 height: 50, 75 backgroundColor: 'white', 76 borderRadius: 12, 77 padding: 12, 78 shadowColor: '#000', 79 shadowOffset: { 80 width: 0, 81 height: 1, 82 }, 83 shadowOpacity: 0.2, 84 shadowRadius: 1.41, 85 86 elevation: 2, 87 }, 88 placeholderStyle: { 89 fontSize: 16, 90 }, 91 selectedTextStyle: { 92 fontSize: 14, 93 }, 94 iconStyle: { 95 width: 20, 96 height: 20, 97 }, 98 inputSearchStyle: { 99 height: 40, 100 fontSize: 16, 101 }, 102 icon: { 103 marginRight: 5, 104 }, 105 item: { 106 padding: 17, 107 flexDirection: 'row', 108 justifyContent: 'space-between', 109 alignItems: 'center', 110 }, 111 selectedStyle: { 112 flexDirection: 'row', 113 justifyContent: 'center', 114 alignItems: 'center', 115 borderRadius: 14, 116 backgroundColor: 'white', 117 shadowColor: '#000', 118 marginTop: 8, 119 marginRight: 12, 120 paddingHorizontal: 12, 121 paddingVertical: 8, 122 shadowOffset: { 123 width: 0, 124 height: 1, 125 }, 126 shadowOpacity: 0.2, 127 shadowRadius: 1.41, 128 129 elevation: 2, 130 }, 131 textSelectedStyle: { 132 marginRight: 5, 133 fontSize: 16, 134 }, 135 });
SelectCountry example 1
1 import React, { useState } from 'react'; 2 import { StyleSheet } from 'react-native'; 3 import { SelectCountry } from 'react-native-element-dropdown'; 4 5 const local_data = [ 6 { 7 value: '1', 8 lable: 'Country 1', 9 image: { 10 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 11 }, 12 }, 13 { 14 value: '2', 15 lable: 'Country 2', 16 image: { 17 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 18 }, 19 }, 20 { 21 value: '3', 22 lable: 'Country 3', 23 image: { 24 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 25 }, 26 }, 27 { 28 value: '4', 29 lable: 'Country 4', 30 image: { 31 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 32 }, 33 }, 34 { 35 value: '5', 36 lable: 'Country 5', 37 image: { 38 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 39 }, 40 }, 41 ]; 42 43 const SelectCountryScreen = _props => { 44 const [country, setCountry] = useState('1'); 45 46 return ( 47 <SelectCountry 48 style={styles.dropdown} 49 selectedTextStyle={styles.selectedTextStyle} 50 placeholderStyle={styles.placeholderStyle} 51 imageStyle={styles.imageStyle} 52 inputSearchStyle={styles.inputSearchStyle} 53 iconStyle={styles.iconStyle} 54 search 55 maxHeight={200} 56 value={country} 57 data={local_data} 58 valueField="value" 59 labelField="lable" 60 imageField="image" 61 placeholder="Select country" 62 searchPlaceholder="Search..." 63 onChange={e => { 64 setCountry(e.value); 65 }} 66 /> 67 ); 68 }; 69 70 export default SelectCountryScreen; 71 72 const styles = StyleSheet.create({ 73 dropdown: { 74 margin: 16, 75 height: 50, 76 borderBottomColor: 'gray', 77 borderBottomWidth: 0.5, 78 }, 79 imageStyle: { 80 width: 24, 81 height: 24, 82 }, 83 placeholderStyle: { 84 fontSize: 16, 85 }, 86 selectedTextStyle: { 87 fontSize: 16, 88 marginLeft: 8, 89 }, 90 iconStyle: { 91 width: 20, 92 height: 20, 93 }, 94 inputSearchStyle: { 95 height: 40, 96 fontSize: 16, 97 }, 98 });
SelectCountry example 2
1 import React, { useState } from 'react'; 2 import { StyleSheet } from 'react-native'; 3 import { SelectCountry } from 'react-native-element-dropdown'; 4 5 const local_data = [ 6 { 7 value: '1', 8 lable: 'Country 1', 9 image: { 10 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 11 }, 12 }, 13 { 14 value: '2', 15 lable: 'Country 2', 16 image: { 17 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 18 }, 19 }, 20 { 21 value: '3', 22 lable: 'Country 3', 23 image: { 24 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 25 }, 26 }, 27 { 28 value: '4', 29 lable: 'Country 4', 30 image: { 31 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 32 }, 33 }, 34 { 35 value: '5', 36 lable: 'Country 5', 37 image: { 38 uri: 'https://www.vigcenter.com/public/all/images/default-image.jpg', 39 }, 40 }, 41 ]; 42 43 const SelectCountryScreen = _props => { 44 const [country, setCountry] = useState('1'); 45 46 return ( 47 <SelectCountry 48 style={styles.dropdown} 49 selectedTextStyle={styles.selectedTextStyle} 50 placeholderStyle={styles.placeholderStyle} 51 imageStyle={styles.imageStyle} 52 iconStyle={styles.iconStyle} 53 maxHeight={200} 54 value={country} 55 data={local_data} 56 valueField="value" 57 labelField="lable" 58 imageField="image" 59 placeholder="Select country" 60 searchPlaceholder="Search..." 61 onChange={e => { 62 setCountry(e.value); 63 }} 64 /> 65 ); 66 }; 67 68 export default SelectCountryScreen; 69 70 const styles = StyleSheet.create({ 71 dropdown: { 72 margin: 16, 73 height: 50, 74 width: 150, 75 backgroundColor: '#EEEEEE', 76 borderRadius: 22, 77 paddingHorizontal: 8, 78 }, 79 imageStyle: { 80 width: 24, 81 height: 24, 82 borderRadius: 12, 83 }, 84 placeholderStyle: { 85 fontSize: 16, 86 }, 87 selectedTextStyle: { 88 fontSize: 16, 89 marginLeft: 8, 90 }, 91 iconStyle: { 92 width: 20, 93 height: 20, 94 }, 95 });
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/hoaphantn7604/react-native-element-dropdown/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/hoaphantn7604/react-native-element-dropdown/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/hoaphantn7604/react-native-element-dropdown/ci.yml/master?enable=pin
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
57 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-3q56-9cc2-46j4
- Warn: Project is vulnerable to: GHSA-6w63-h3fj-q4vw
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-33f9-j839-rf8h
- Warn: Project is vulnerable to: GHSA-c36v-fmgq-m8hx
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
- Warn: Project is vulnerable to: GHSA-7jxr-cg7f-gpgv
- Warn: Project is vulnerable to: GHSA-xj72-wvfv-8985
- Warn: Project is vulnerable to: GHSA-ch3r-j5x3-6q2m
- Warn: Project is vulnerable to: GHSA-p5gc-c584-jj6v
- Warn: Project is vulnerable to: GHSA-whpj-8f3w-67p5
- Warn: Project is vulnerable to: GHSA-cchq-frgv-rjh5
- Warn: Project is vulnerable to: GHSA-g644-9gfx-q4q4
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
3.2
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More