Frontend Development 12 min read

Design and Implementation of a Dynamic H5 Navigation Bar Component for Mobile Apps

This document outlines the challenges of native mobile navigation bars, presents the @pango/navigation-bar React component as a high‑performance, low‑cost, and highly customizable solution, details its features, exception handling, installation, configuration, usage examples, and future open‑source plans.

JD Retail Technology
JD Retail Technology
JD Retail Technology
Design and Implementation of a Dynamic H5 Navigation Bar Component for Mobile Apps

Background: In mobile pages the navigation bar is a critical UI element that provides fast access to different pages or functions, and its high exposure makes a dynamic, flexible navigation bar essential for product empowerment.

Problems with native navigation bars (iOS and Android) include performance degradation, high development and testing cost, limited scenario support, poor user experience during page transitions, difficulty extending interactive effects, strong dependency on native bridges, and version‑control issues.

Solution: The @pango/navigation-bar component was created to replace native bars with a generic H5 navigation bar that supports SSR pre‑rendering, offers fast on‑screen rendering, reduces development and testing effort by over 90%, works in both internal and external scenes, and is fully configurable via a JSON‑like config.

Key advantages: High performance – supports SSR pre‑rendering for quicker display. Low development/testing cost – minimal manpower required. Flexible customization – left, middle, and right sections accept React elements, allowing custom search boxes, icons, animations, etc. Excellent device compatibility – adapts to foldable and notch screens on iOS 9+ and Android 5+. No external dependencies – handcrafted without third‑party libraries.

Exception handling: The component ensures a return button is rendered with an a tag to remain functional during JS errors, provides fallback navigation data for error pages, and handles HTML load failures or service exceptions by showing the native bar when needed.

Implementation details: The component is published on JNPM (size 4.1 KB) and built with React + TypeScript. Installation command: npm i @pango/navigation-bar --registry=http://registry.m.jd.com . Configuration example includes items such as back, more, follow, logo, and custom common items, with a scroll callback for interactive animations.

Usage example (React): import { BACK_ICON, MORE_ICON, FOLLOW_ICON, INavigationParams } from "@pango/navigation-bar"; const navBarParams: INavigationParams = { leftItems: [backItem, backLogo], rightItems: [moreItem, follow], backgroundColor: "#FD4D00", navHeight: this.status.navHeight, titleImgItem: TitleSearch({}), scrollCallBack: (scale) => { /* update UI based on scroll */ } }; Then render with <NavigationBar className="nav-bar" params={navBarParams} barHeight={200} /> .

Current projects using the component include 百亿补贴, 月黑风高, and PLUS95折, with online results demonstrated via screenshots.

Future plans: After security review the component will be open‑sourced, and further iterations will add stricter UI design guidelines and a native‑independent pull‑to‑refresh mechanism.

frontendmobileperformanceTypeScriptReactUI Componentnavigation bar
JD Retail Technology
Written by

JD Retail Technology

Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.