React Native Theme TransitionReact Native Theme Transition
API

ThemeTransitionProvider

Provider component that supplies animated theme colors via context.

Wraps your app tree and provides the theme context. Place as high as possible in the component tree: above navigation, above modals. The screenshot captures everything inside the provider's root View.

<ThemeTransitionProvider initialTheme="system">
  <App />
</ThemeTransitionProvider>

Props

PropTypeRequiredDescription
childrenReactNodeyesYour application tree
initialThemeThemeName | 'system'yesTheme for the first frame

Initial theme behavior

  • Read once when the provider first mounts. If a parent re-renders and passes a different initialTheme, the provider ignores it. To change themes after mount, call setTheme()
  • 'system' reads OS appearance synchronously (zero flash) and subscribes to changes
  • With custom names: requires systemThemeMap in config, otherwise throws
  • An explicit theme name (e.g. 'dark') does not subscribe to OS changes

Placement

Content outside the provider won't be included in the transition screenshot.

// Correct: navigation inside provider
<ThemeTransitionProvider initialTheme="system">
  <NavigationContainer>
    ...
  </NavigationContainer>
</ThemeTransitionProvider>
// Wrong: provider inside navigation, only captures current screen
<NavigationContainer>
  <ThemeTransitionProvider initialTheme="system">
    ...
  </ThemeTransitionProvider>
</NavigationContainer>

Bottom sheets (e.g. @gorhom/bottom-sheet) must be inside the provider so their backdrop is captured in the screenshot. React Native's built-in Modal renders in a separate native window and won't be captured.

See Also

On this page