Skip to content

Comments

feat: add app-config driven native tab visibility#353

Merged
najuna-brian merged 1 commit intoOpenDataEnsemble:devfrom
najuna-brian:feat/formulus-navigation-tabs-config
Feb 24, 2026
Merged

feat: add app-config driven native tab visibility#353
najuna-brian merged 1 commit intoOpenDataEnsemble:devfrom
najuna-brian:feat/formulus-navigation-tabs-config

Conversation

@najuna-brian
Copy link
Contributor

Description

Adds native tab visibility control from app.config.json for custom apps.

Custom apps can now decide which bottom tabs are shown using:

  • navigation.tabs: ["Home", "Sync", "More"] (whitelist, ordered)
  • navigation.tabs: [] (hide tab bar)
  • no navigation key (default behavior: show all native tabs)

Supported visible tab IDs:
Home, Forms, Observations, Sync, More
Closes #350


What changed

  • Added visible-tab constants/types (VISIBLE_MAIN_TABS, VisibleMainTab)
  • Extended app config type with optional navigation.tabs
  • Refactored MainTabNavigator to:
    • read navigation.tabs from AppConfigService
    • validate configured tab IDs at runtime
    • warn + skip invalid values
    • preserve configured order
    • render tabs dynamically
    • hide tab bar when tabs: []

Settings, About, and Help remain hidden tab routes (unchanged behavior).


How it works (flow)

custom app app.config.json
        │
        ▼
AppConfigService.loadConfig()
        │
        ▼
MainTabNavigator.getConfiguredTabs()
  - no navigation.tabs  -> default visible tabs
  - invalid tab values  -> warn + skip
  - []                  -> hide tab bar
        │
        ▼
Dynamic Tab.Screen rendering (in configured order)

Example for custom apps (app.config.json)

{
  "$schema": "https://ode.dev/schemas/app-config-v1.json",
  "name": "My Custom App",
  "version": "1.0.0",
  "navigation": {
    "tabs": ["Home", "Sync", "More"]
  },
  "theme": {
    "light": { "...": "..." },
    "dark": { "...": "..." }
  }
}

Behavior notes

  • This is UI navigation control only.
  • It does not restrict Formulus API access (openFormplayer, getObservations, etc.).

Copy link
Contributor

@r0ssing r0ssing left a comment

Choose a reason for hiding this comment

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

Looks great! I was wondering if a blacklist would have been better 🤔, but I think you're right to choose a whitelist! This will mean that if in the future wr add some new button to Formulus, people would have to update their custom apps to get it, instead of it popping up automatically.. I think this is a good design principle, so we ensure minimal 'surprises' for the users 🦒🤙

@najuna-brian
Copy link
Contributor Author

Properly stated about the whitelist and it what I had in mind choosing it over blacklist

@najuna-brian najuna-brian merged commit 4f5315d into OpenDataEnsemble:dev Feb 24, 2026
10 checks passed
@najuna-brian najuna-brian deleted the feat/formulus-navigation-tabs-config branch February 24, 2026 19:49
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.

[Formulus] Navigation Visibility Control via app.config.json

2 participants