platform-bible-react
    Preparing search index...

    Function useTabIconSelection

    • Resolves which tab-icon variant a web view tab should show, given the current theme and this tab's live selected state.

      The tab icon is painted by the platform as a static CSS background-image, so a currentColor SVG can't follow the theme or selection state — callers must swap the actual icon URL. "Selected" here means this tab is the active one in its group: rc-dock renders exactly one tab's pane at a time, hiding the rest with display: none, so "my pane is currently visible" and "I'm the selected tab" are the same condition — this reuses useViewVisibility's event-driven IntersectionObserver detection rather than polling frameElement.offsetParent on an interval. pickTabIconUrl's undefined ("selection unknown") case is effectively unreachable through this call site, since useViewVisibility resolves synchronously on first render with no unknown window, but pickTabIconUrl keeps accepting it as a standalone, independently-testable function.

      Callers own the theme subscription themselves (e.g. papi.themes.subscribeCurrentTheme) and pass the resulting isDarkTheme in — this hook has no PAPI dependency.

      Parameters

      • isDarkTheme: boolean

        Whether the current theme is dark.

      • tabIconUrls: TabIconUrls

        The four icon variant URLs for this tab.

      Returns string

      The icon URL to pass to updateWebViewDefinition({ iconUrl }).