UNPKG

expo-select-dropdown

Version:

Expo / React Native Select Dropdown with search and other customizations

39 lines 1.38 kB
import { Text, StyleSheet, Pressable } from "react-native"; export default function DropdownItem({ items, item, index, select, usePressable }) { if (usePressable) return (<Pressable testID={`dropdown-item-${item.key}`} key={item.key} style={[style.container, index === 0 && style.firstItem, index === items.length - 1 && style.lastItem]} onPress={() => select(item)}> <Text style={style.text}> {item.value} </Text> </Pressable>); return (<Pressable testID={`dropdown-item-${item.key}`} key={item.key} style={[style.container, index === 0 && style.firstItem, index === items.length - 1 && style.lastItem]} onPress={() => select(item)}> <Text style={style.text}> {item.value} </Text> </Pressable>); } const style = StyleSheet.create({ container: { flexDirection: "row", flexGrow: 1, paddingVertical: 8, alignItems: "center", justifyContent: "space-between", borderBottomWidth: 1, borderBottomColor: "#E5E7EB", }, text: { flex: 1, fontWeight: "500", fontSize: 16, paddingHorizontal: 12, color: "#3F3F46", }, firstItem: { paddingBottom: 8, }, lastItem: { borderBottomWidth: 0, }, }); //# sourceMappingURL=DropdownItems.js.map