Micck Davis
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Mastering Search Filter Implementation in React Native App ![](https://hackmd.io/_uploads/Sy57HVXan.png) In any data-heavy app, users become overwhelmed by the huge content volume. A search filter integrated into their app helps them find what they are looking for. So, if you want to improve overall user satisfaction and the application's usability, learn to build a search filter in React Native. Being a go-to mobile app development framework, experts of a [React Native app development company](https://www.4waytechnologies.com/react-native-app-development) add such a feature in no time. However, to start the project, you must perform some basic prerequisites. **Get your System Compatible with the Environment** If it is your first project with the React Native framework, you will need to establish the specific environment. Further, you need to select a Command Line Interface for the project. There are two options that you can choose from. They include Expo CLI and React Native CLI. These two differ in customizability, size, ease of use, and even setup processes. For this particular project, we have chosen to use Expo CLI. So, you have to set up the dev system accordingly. You will find more detailed instructions from the article '[How to set up the React Native Development Environment](https://www.4waytechnologies.com/blog/how-to-set-up-the-react-native-development-environment)'. **Build a Folder** In the second step, create a dedicated folder to save your code and assets. This folder forms the backbone of your project structure and helps keep things organized as you develop your app. Follow these steps: * Choose any directory on your system. * Open the terminal/command prompt from this directory. You might do this by right-clicking inside the folder and choosing 'Open Terminal here' or 'Open Command Prompt here'. * Once the terminal is open, type the following command: npm i -global expo-cli. This command installs the Expo CLI globally on your system. After entering this command, wait for a while as your system installs the necessary files. Once the process completes, you'll have your project folder set up. **Installing External Libraries** For this project, use the expo/vector-icons library. This library is quite a useful resource to access readily available icons. With this library, you can easily integrate icons into your application without putting in much effort, saving considerable time and effort. This use of third-party libraries, like expo/vector-icons, to streamline development and focus on optimizing code is a key strength of the React Native framework. Leveraging existing, well-tested libraries rather than starting from ground zero helps speed development. **The Coding Section for the Project** So, here's what you need to do: You have to create three component files, namely List.js, SearchBar.js, and Home.js. These components will play a vital role in the current application. And don't forget about the main file, App.js, where we'll bring everything together. But that's not all! You also need to store some data, right? So, create a Data.js file to keep all relevant data organized and accessible throughout the app. **How to Store Data in the Data.js File?** To store all data you want to show as an option, save every detail in the Data.js file. ![](https://hackmd.io/_uploads/HJYbHV7Th.png) The given syntax in the Data.js frames array of objects. It has details about various programming languages. The export default is used to ensure that this data set is accessible in other parts of the project (may be in the App.js). Now, the dataset has 9 objects. Each object has three properties, namely 'id', 'name', and 'details'. These properties hold specific information about each programming language. With this data, you can perform different activities, such as show the details of programming languages, filter them based on definite criteria, or perform some calculations based on the given information. Isn't it cool? **Creating the Home Screen** The given snippet shows a part of the Home.js. Let’s get a detailed explanation of this file. ![](https://hackmd.io/_uploads/SkNyBNman.png) The main functional component, ‘Home’, displays a list of programming languages. It includes a search bar and has some basic state management. React, useState, useEffect are imported from the "react" library. useState and useEffect are React Hooks which are useful for state management. ‘SafeAreaView’, ‘Text’, ‘ActivityIndicator’, ‘StyleSheet’ are imported from the "react-native" library. The ‘ActivityIndicator’ displays a circular loading spinner. List, and SearchBar are custom components. They are imported from a local directory. The program uses three pieces of state initialized using the useState Hook: ‘searchPhrase’, ‘clicked’, and ‘fakeData’. useEffect Hook is run once when the component mounts (because of the empty dependency array []). It defines an async function, ‘getData’ to fetch data from an API. It also updates the fakeData state with the result. The main functional component returns a JSX structure displaying the following components. * A Text component to display the title "Programming Languages". * The SearchBar component, with its props being the search phrase and functions to update the search phrase and the clicked state. * An ActivityIndicator is to be displayed when fakeData is null (i.e., the data is still being fetched). The List component receives the search phrase, the data from the API, and a function to update the clicked state. This component is shown when ‘fakeData’ is not null. The ‘SafeAreaView’ component ensures that the content is displayed within the safe area boundaries of a device. The 'styles.root' applied to it is part of a stylesheet. **What to Add in the App.js File?** ![](https://hackmd.io/_uploads/HJmpE47a3.png) It is the main file of the project. It is meant to display a list of programming languages in a way to implement search in react native app. It has a search bar allowing users to filter out the option. What the code snippet does is given below. It starts by importing components from React and React Native libraries. The useState hook is used to create "variables" that the app can alter based undefined action. For example, searchPhrase is used to remember what a user types in the search bar. The ‘fakeData’ remembers the list of programming languages that are fetched from the Data.js file. The return statement describes what the app looks like. It has a search bar at the top and a list located at the bottom. If the user does not perform the fetching, a loading indicator is shown in its place. **How To Execute the Program?** This part is about checking how your app looks and works on an actual smart phone device or on the emulator. You can follow either of the mentioned ways On your phone: If you want to run your built app on your own phone, download an app called "Expo Go". Then, scan a QR code (like the ones used for menus in restaurants). This QR code appears in your computer's terminal (the black and white text box) However, make sure to open the terminal from your app folder and then run a command expo start. On your computer: To run the build on your computer instead, you use an emulator. Start your project using the expo start command, then wait for a moment. The app will show up on the emulator, and you can play around with it just like you would do on a real phone. Here is the output of the project. ![](https://hackmd.io/_uploads/SJnY4V7ah.gif) Build your own So, to create this neat little mobile app where you can search through different programming languages, you don’t need a long experience in coding. Just a basic knowledge of React Native would suffice.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully