import * as React from "react"; import { View, StyleSheet, Picker as NativePicker } from "react-native"; import { withTheme } from "../../core/theming"; import TextField from "../TextField"; import Touchable from "../Touchable"; import { PickerComponentProps } from "./PickerTypes"; const Picker: React.FC = ({ style, options, placeholder, selectedValue, disabled = false, onValueChange: onValueChangeOverride = () => {}, ...props }) => { const textField = React.useRef(undefined); const onValueChange = (itemValue: string, itemIndex: number) => { toggleFocus(); onValueChangeOverride(itemValue, itemIndex); }; const toggleFocus = () => { if (!disabled) { // @ts-ignore textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme() } }; return ( onValueChange(value.toString(), index) } style={{ flex: 1, opacity: 0, position: "absolute", top: 0, left: 0, right: 0, bottom: 0, }} > {options.map((o) => ( ))} ); }; const styles = StyleSheet.create({ container: { alignSelf: "stretch", }, }); export default withTheme(Picker);