mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 10:23:24 +00:00
chore: only focus when search button is tapped
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { TextInput, View } from "react-native";
|
||||
import { useFocusEffect } from "expo-router";
|
||||
import { FontAwesome5 } from "@expo/vector-icons";
|
||||
|
||||
import Colors from "@movie-web/tailwind-config/colors";
|
||||
@@ -23,19 +22,6 @@ export function SearchBar({
|
||||
};
|
||||
}, [focusSearchInputRef]);
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
// When the screen is focused
|
||||
const focus = () => {
|
||||
setTimeout(() => {
|
||||
inputRef?.current?.focus();
|
||||
}, 20);
|
||||
};
|
||||
focus();
|
||||
return focus; // cleanup
|
||||
}, []),
|
||||
);
|
||||
|
||||
const handleChange = (text: string) => {
|
||||
setKeyword(text);
|
||||
onSearchChange(text);
|
||||
|
Reference in New Issue
Block a user