Tamagui Provider Wrapper (views/TamaguiProvider.tsx)

tamagui · code/ui/tamagui/src/views/TamaguiProvider.tsx · typescript · MIT
ui, fw:react, tag:tamagui

Wraps applications with Tamagui context, portal provider, and z-index stack. Reuse to initialize the Tamagui UI system.

// Source: https://github.com/tamagui/tamagui.git | License: MIT | Copyright 2020 Nate Wienert
// Provided via justclaw.it.com; keep this notice with the code.
import type { TamaguiProviderProps } from '@tamagui/core'
import { TamaguiProvider as OGProvider } from '@tamagui/core'
import { PortalProvider } from '@tamagui/portal'
import { ZIndexStackContext } from '@tamagui/z-index-stack'

export const TamaguiProvider = ({ children, ...props }: TamaguiProviderProps) => {
  return (
    <OGProvider {...props}>
      <ZIndexStackContext.Provider value={1}>
        <PortalProvider shouldAddRootHost>{children}</PortalProvider>
      </ZIndexStackContext.Provider>
    </OGProvider>
  )
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key