From fbababc26dceb7a40ce849e5de3675f5b0cedb47 Mon Sep 17 00:00:00 2001 From: jfrye122 Date: Fri, 5 May 2023 09:20:23 -0400 Subject: [PATCH] added selectCostCenter.jsx --- components/Selects/select-cost-center.jsx | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 components/Selects/select-cost-center.jsx diff --git a/components/Selects/select-cost-center.jsx b/components/Selects/select-cost-center.jsx new file mode 100644 index 0000000..4bf0795 --- /dev/null +++ b/components/Selects/select-cost-center.jsx @@ -0,0 +1,95 @@ +import React, { useState } from "react"; +import { StyleSheet, Text, View } from "react-native"; +import { Dropdown } from "react-native-element-dropdown"; +import { connect } from "react-redux"; + +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" }, +]; + +export function SelectCostCenter(props) { + const [value, setValue] = useState(null); + const [isFocus, setIsFocus] = useState(false); + + + return ( + + setIsFocus(true)} + onBlur={() => setIsFocus(false)} + onChange={(item) => { + setValue(item.value); + setIsFocus(false); + }} + /> + + ); +} + +const mapStateToProps = (state) => ({}); + +const mapDispatchToProps = {}; + +export default connect(mapStateToProps, mapDispatchToProps)(SelectCostCenter); + +const styles = StyleSheet.create({ + container: { + backgroundColor: "white", + padding: 16, + justifyContent: "center", + alignContent: "center", + }, + dropdown: { + height: 50, + borderColor: "gray", + borderWidth: 0.5, + borderRadius: 8, + paddingHorizontal: 8, + }, + icon: { + marginRight: 5, + }, + label: { + position: "absolute", + backgroundColor: "white", + left: 22, + top: 8, + zIndex: 999, + paddingHorizontal: 8, + fontSize: 14, + }, + placeholderStyle: { + fontSize: 16, + }, + selectedTextStyle: { + fontSize: 16, + }, + iconStyle: { + width: 20, + height: 20, + }, + inputSearchStyle: { + height: 40, + fontSize: 16, + }, +});