import * as React from "react"; import { View, StyleSheet } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { Picker as NativePicker } from "@react-native-community/picker"; import { withTheme } from "../../core/theming"; import Portal from "../Portal/Portal"; import Button from "../DeprecatedButton"; import TextField from "../TextField"; import Touchable from "../Touchable"; import { PickerComponentProps } from "./PickerTypes"; const Picker: React.FC = ({ style, options, placeholder, selectedValue, disabled = false, onValueChange = () => {}, theme: { colors }, ...props }) => { const textField = React.useRef(undefined); const [pickerVisible, setIsPickerVisible] = React.useState(false); const toggleVisibility = () => { setIsPickerVisible(!pickerVisible); // @ts-ignore textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme() }; return ( {pickerVisible && ( onValueChange(value.toString(), index) } > {options.map((o) => ( ))} )} ); }; const styles = StyleSheet.create({ container: { alignSelf: "stretch", }, picker: { position: "absolute", bottom: 0, left: 0, right: 0, flexDirection: "row", justifyContent: "center", }, pickerContainer: { flexDirection: "column", width: "100%" }, closeButton: { alignSelf: "flex-end", }, }); export default withTheme(Picker);