obytes / react-native-template-obytes

📱 A template for your next React Native project: Expo, PNPM, TypeScript, TailwindCSS, Husky, EAS, GitHub Actions, Env Vars, expo-router, react-query, react-hook-form.
https://starter.obytes.com
MIT License
2.19k stars 321 forks source link

Refactoring Tab Navigation for Scalability #358

Closed 97Fakhreddine closed 1 week ago

97Fakhreddine commented 3 weeks ago

What does this do?

This refactor extracts the tab navigation configuration from the TabLayout component and centralizes it into a bottomNavTabs array. This array contains the configuration for each tab, including names, titles, icons, and additional options like headerShown. The TabLayout component now dynamically renders tabs based on this configuration.

Why did you do this?

The previous approach of defining tabs directly within the TabLayout component made the code harder to maintain and extend as the number of tabs increased. By centralizing the configuration in a bottomNavTabs array, we improve the scalability, reusability, and cleanliness of the code. This refactor ensures that adding new tabs or modifying existing ones is straightforward and reduces the risk of errors as the application grows.

Who/what does this impact?

This change impacts the way tabs are defined and managed within the application. It provides a more scalable solution for adding or modifying tabs and may require developers working on navigation to familiarize themselves with the new bottomNavTabs configuration. However, it does not introduce any breaking changes to existing functionality.

How did you test this?

The changes were tested by verifying that the tab navigation continues to function as expected, including the correct display of icons, titles, and navigation behaviors. Additionally, scenarios involving the addition of new tabs were tested to ensure that the new configuration approach works seamlessly.

netlify[bot] commented 3 weeks ago

Deploy Preview for obytes-starter canceled.

Name Link
Latest commit 324bf5bfea4f4a56cb65b7dd721ea418f19f56c9
Latest deploy log https://app.netlify.com/sites/obytes-starter/deploys/66e00e54190f33000899b8a7
yjose commented 1 week ago

Thank you @97Fakhreddine for your contribution. I think what you did is good, but I don't think it is necessary for the template. for two reason.