fix: refactor

This commit is contained in:
Fredrik Burmester
2024-08-15 16:46:50 +02:00
parent 92a260b6f5
commit aa0fbd6fad
5 changed files with 229 additions and 140 deletions

View File

@@ -1,3 +1,4 @@
import { useFocusEffect } from "expo-router";
import React, { useEffect } from "react";
import { TextInputProps, TextProps } from "react-native";
import { TextInput } from "react-native";
@@ -5,9 +6,11 @@ export function Input(props: TextInputProps) {
const { style, ...otherProps } = props;
const inputRef = React.useRef<TextInput>(null);
useEffect(() => {
inputRef.current?.focus();
}, []);
useFocusEffect(
React.useCallback(() => {
inputRef.current?.focus();
}, []),
);
return (
<TextInput
@@ -17,6 +20,7 @@ export function Input(props: TextInputProps) {
style={[{ color: "white" }, style]}
{...otherProps}
placeholderTextColor={"#9CA3AF"}
clearButtonMode="while-editing"
/>
);
}