Files
streamyfin/components/common/Input.tsx
Fredrik Burmester aa0fbd6fad fix: refactor
2024-08-15 16:46:50 +02:00

27 lines
734 B
TypeScript

import { useFocusEffect } from "expo-router";
import React, { useEffect } from "react";
import { TextInputProps, TextProps } from "react-native";
import { TextInput } from "react-native";
export function Input(props: TextInputProps) {
const { style, ...otherProps } = props;
const inputRef = React.useRef<TextInput>(null);
useFocusEffect(
React.useCallback(() => {
inputRef.current?.focus();
}, []),
);
return (
<TextInput
ref={inputRef}
className="p-4 border border-neutral-800 rounded-xl bg-neutral-900"
allowFontScaling={false}
style={[{ color: "white" }, style]}
{...otherProps}
placeholderTextColor={"#9CA3AF"}
clearButtonMode="while-editing"
/>
);
}