Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #191
What was changed
This pull request modifies the search bar functionality so that it is only available when toggled by clicking the search icon. Once the search icon is clicked, the search bar appears; clicking the icon again hides the search bar.
Why was it changed
Previously, the search bar was permanently fixed in the header, taking up space when it is not needed, which lead to a poor user experience. By making the search bar toggled by a search icon, we keep the interface cleaner and simpler, leading to an improved user experience.
How was it changed
To implement the changes, I made a few code changes. First, I added a state variable for the search bar,
isSearchVisible
by using theuseState
hook. I added aTouchableOpacity
icon which when pressed would set theisSearchVisible
totrue
orfalse
depending on whether the search bar should be available or not. I then added conditional rendering for the search bar. Lastly, I implemented an "X" icon when the search bar was toggled, and a search icon when it was not toggled.