Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search bar toggle functionality #194

Merged
merged 4 commits into from
Nov 4, 2024
Merged

Conversation

AmarHadzic
Copy link
Collaborator

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 the useState hook. I added a TouchableOpacity icon which when pressed would set the isSearchVisible to true or false 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.

__tests__/HomeScreen.test.tsx Show resolved Hide resolved
lib/screens/HomeScreen.tsx Show resolved Hide resolved
lib/screens/HomeScreen.tsx Show resolved Hide resolved
lib/screens/HomeScreen.tsx Show resolved Hide resolved
Copy link
Collaborator

@rcAsironman rcAsironman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmarHadzic Your work looks good, but I noticed a few issues in the code. I’ve attached media to show these issues:

Issue 1:
When I close the search bar by clicking the cross icon, the search state doesn’t clear. This is preventing me from seeing the notes.

screen-20241028-180244.mp4

Issue 2:
In dark mode, both the search icon and the close icon are white, which doesn’t look very clear. Please change the icons to black for better contrast.

IMG_0222

Copy link
Collaborator

@rcAsironman rcAsironman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm;

@rcAsironman rcAsironman merged commit b0f0728 into main Nov 4, 2024
1 check passed
@rcAsironman rcAsironman deleted the feature/search-bar-toggle branch November 4, 2024 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Search Bar Toggle on Search Icon Click
4 participants