ScreenControllerProvider

Provider for ScreenControllerContext

import { ScreenControllerProvider } from "@roku-sdk/navigation";
ScreenControllerProvider(props: IScreenControllerProviderProps): JSX.Element

Description

Provider for ScreenControllerContext.

Holds a stack of screen factory functions. The provider itself does not render any chrome around the screens — it simply renders every stack entry bottom-to-top, so the consumer is responsible for visually covering lower screens (paint a background, set visible={false}, etc.) when the top screen is meant to fully obscure them.

Screens are typically pushed/replaced via pushScreen(factory) / setScreen(factory). Pass null to render the provider's fallback factory at that slot.

Apps that prefer addressing screens by string id can layer a thin "registry" wrapper on top of this controller; see the showcase's ScreenRegistryContext for a canonical example.

Parameters

NameTypeDescription
propsIScreenControllerProviderPropsThe app content and the fallback screen factory.

Example

<ScreenControllerProvider fallback={() => <HomeScreen />}>
  <App />
</ScreenControllerProvider>

Types

IScreenControllerProviderProps

Props accepted by ScreenControllerProvider.

NameTypeDescription
childrenElementThe app content that can read ScreenControllerContext. The provider renders only these children; the screen stack appears wherever a descendant places getScreen().
fallback() => ElementFactory for the fallback screen. Used when a stack entry's factory is null, when resetScreen() is called with no argument, or when the stack is empty.

What’s Next

Did this page help you?