Skip to content

Commit

Permalink
feat(search): load search data every time
Browse files Browse the repository at this point in the history
  • Loading branch information
stantanasi committed Aug 31, 2024
1 parent 6ccc79d commit c6aa67c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions screens/search/SearchScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export default function SearchScreen({ navigation, route }: Props) {
const [recipes, setRecipes] = useState<Model<IRecipe>[]>([])

useEffect(() => {
const fetchRecipes = async () => {
const unsubscribe = navigation.addListener('focus', async () => {
const recipes = await RecipeModel.search(query)

setRecipes(recipes)
}
})

fetchRecipes()
}, [query])
return unsubscribe
}, [navigation, query])

return (
<View style={styles.container}>
Expand Down

0 comments on commit c6aa67c

Please sign in to comment.