Comments (5)
hi @colinbes,
This issue is resolved.
Please install later version. Use "inside" props is true.
Code EX:
import React, { useState } from 'react';
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
import { MultiSelect } from 'react-native-element-dropdown';
import AntDesign from 'react-native-vector-icons/AntDesign';
const data = [
{ label: 'Item 1', value: '1' },
{ label: 'Item 2', value: '2' },
{ label: 'Item 3', value: '3' },
{ label: 'Item 4', value: '4' },
{ label: 'Item 5', value: '5' },
{ label: 'Item 6', value: '6' },
{ label: 'Item 7', value: '7' },
{ label: 'Item 8', value: '8' },
];
const MultiSelectComponent = () => {
const [selected, setSelected] = useState([]);
const renderItem = (item: any) => {
return (
<View style={styles.item}>
<Text style={styles.selectedTextStyle}>{item.label}</Text>
<AntDesign style={styles.icon} color="black" name="Safety" size={20} />
</View>
);
};
return (
<MultiSelect
style={styles.dropdown}
placeholderStyle={styles.placeholderStyle}
selectedTextStyle={styles.selectedTextStyle}
inputSearchStyle={styles.inputSearchStyle}
iconStyle={styles.iconStyle}
data={data}
labelField="label"
valueField="value"
placeholder="Select item"
value={selected}
search
inside
searchPlaceholder="Search..."
onChange={item => {
setSelected(item);
}}
renderLeftIcon={() => (
<AntDesign style={styles.icon} color="black" name="Safety" size={20} />
)}
renderItem={renderItem}
renderSelectedItem={(item, unSelect) => (
<TouchableOpacity onPress={() => unSelect && unSelect(item)}>
<View style={styles.selectedStyle}>
<Text style={styles.textSelectedStyle}>{item.label}</Text>
<AntDesign color="black" name="delete" size={17} />
</View>
</TouchableOpacity>
)}
/>
);
};
export default MultiSelectComponent;
const styles = StyleSheet.create({
dropdown: {
marginTop: 32,
backgroundColor: 'white',
borderRadius: 12,
padding: 12,
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.2,
shadowRadius: 1.41,
elevation: 2,
},
placeholderStyle: {
fontSize: 16,
},
selectedTextStyle: {
fontSize: 14,
},
iconStyle: {
width: 20,
height: 20,
},
inputSearchStyle: {
height: 40,
fontSize: 16,
},
icon: {
marginRight: 5,
},
item: {
padding: 17,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
selectedStyle: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 14,
backgroundColor: 'white',
shadowColor: '#000',
marginVertical: 8,
marginRight: 12,
paddingHorizontal: 12,
paddingVertical: 8,
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.2,
shadowRadius: 1.41,
elevation: 2,
},
textSelectedStyle: {
marginRight: 5,
fontSize: 16,
},
});
from react-native-element-dropdown.
hi @colinbes ,
I'm working on it.
from react-native-element-dropdown.
Super!
from react-native-element-dropdown.
from react-native-element-dropdown.
Thanks for digging in, the solution is working well.
Question: It's not a train smash and I can work around it but any suggestions if my data is simply a list of strings, i.e., data=['item1', 'item2]
from react-native-element-dropdown.
Related Issues (20)
- Data not populating: Android
- Exclude item from search HOT 1
- Item padding in the Drop Down list HOT 1
- When dropdown is open, if we scroll whole dropdown is scrolling HOT 3
- react-native-element-dropdown dropdown above screen edge HOT 1
- Outside action not working first time
- Support for defaultProps will be removed. Use JS default parameters instead. HOT 8
- suggest to support allowFontScaling or titleMaxFontSizeMultiplier HOT 1
- Scroll To Index throws an error on large datasets when searching HOT 6
- Invariant Violation: scrollToIndex out of range: requested index 28 is out of 0 to 1, js engine: hermes HOT 5
- Crashes in production only - iOS
- The entire Lodash library is being imported HOT 1
- search prameter HOT 1
- Dropdown height css HOT 2
- Persist search query in search bar
- TypeError: Cannot read property 'Dropdown' of undefined HOT 1
- onChange event not firing
- incorrect type for value prop
- Can I animate dropdown with animation libraries?
- unfiltered data even when Search text is added when keyboard is closed and when keyboard is opened user unable see the options.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-element-dropdown.