How gorhom/react-native-animated-tabbar works
Project type and purpose
• This is an open-source React Native UI component library published as @gorhom/animated-tabbar.
• It provides two main components:
• AnimatedTabBar – a React Navigation integrated bottom-tab bar.
• AnimatedTabBarView – a standalone tab-bar view for any React Native app.
• It ships multiple animation “presets” (bubble, flashy, material) and is written in TypeScript.
File structure
• Top-level: configuration files (babel.config.js, tsconfig.json, .eslintrc.js, release scripts, docs).
• src/: core library code
• AnimatedTabBar.tsx, AnimatedTabBarView.tsx – entry points.
• components/ – shared subcomponents (e.g., RawButton).
• hooks/ – custom React hooks for spacing, visibility, transitions.
• presets/ – three preset folders, each with its own TabBar, TabBarItem, styles, types.
• utilities/ – tiny helpers (noop, reanimated wrapper).
• index.ts – public API.
• example/: a runnable React Native demo (iOS & Android) showing usage and integration with React Navigation v4 & v5.
• docs/: markdown documentation and animated previews.
• CI / GitHub templates, CONTRIBUTING, CHANGELOG, LICENSE, release templates.
README for additional insights
• Confirms architecture: it relies on React Native Reanimated v2, Gesture Handler, Svg.
• Supports standalone and React Navigation integration.
• Presents API surface and customizable props.
• Describes presets and migration.
1) Consumer App (Example or any RN app)
2) AnimatedTabBar package
– Public API layer (index.ts)
– AnimatedTabBar / AnimatedTabBarView components
– Presets module (bubble, flashy, material)
– Shared components & hooks
– Utilities
3) React Native runtime
– JS thread
– Native modules: Reanimated, Gesture Handler, Svg
4) React Navigation (optional integration)
b. Relationships & interactions:
– Consumer App → imports @gorhom/animated-tabbar → calls AnimatedTabBar or AnimatedTabBarView.
– These components use presets (strategy pattern) to render TabBarItems.
– Hooks calculate animation values & spacing, then feed into Reanimated nodes.
– UI rendered by RN’s bridging layer and native modules (reanimated worklets, gesture handler events).
– If React Navigation is used, AnimatedTabBar receives navigation props and calls onIndexChange to navigate.
c. Architectural patterns / design principles:
– Modular preset architecture (each animation preset is a plug-in).
– Hooks for cross-cutting concerns (spacing, RTL, visibility).
– Single responsibility: core view vs. preset vs. utility vs. hook.
– Separation of API surface (index.ts) from implementation.
d. Relevant technologies:
– React Native & React
– TypeScript
– react-native-reanimated (animation engine)
– react-native-gesture-handler (touch events)
– @react-navigation/bottom-tabs (optional)
– @react-native-community/bob (build tooling)
Elements
• from Consumer App to API layer
• API → core component → preset → native modules
• core component ↔ hooks/utilities
• React Navigation → AnimatedTabBar (bidirectional)
• Blue rectangles for JS modules (API, components, presets, hooks).
• Yellow hexagons for build/config (babel, tsconfig).
• Grey parallelogram for Consumer App / Example.
Final advice
• Be very detailed: break down the package into entry points, shared modules, preset implementations, hooks, utilities, and external dependencies.
• Don’t overthink: more components = more clarity.
• Use a layered view: top = Consumer App; middle = Library internals; bottom = RN runtime & native modules.