import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; import { PostHog, PostHogOptions } from './posthog-rn'; import { PostHogAutocaptureOptions } from './types'; /** * Props for the PostHogProvider component. * * @public */ export interface PostHogProviderProps { /** The child components to render within the PostHog context */ children: React.ReactNode; /** PostHog configuration options */ options?: PostHogOptions; /** Your PostHog API key */ apiKey?: string; /** An existing PostHog client instance */ client?: PostHog; /** Autocapture configuration - can be a boolean or detailed options */ autocapture?: boolean | PostHogAutocaptureOptions; /** Enable debug mode for additional logging */ debug?: boolean; /** Custom styles for the provider wrapper View */ style?: StyleProp; } /** * PostHogProvider is a React component that provides PostHog functionality to your React Native app. You can find all configuration options in the [React Native SDK docs](https://posthog.com/docs/libraries/react-native#configuration-options). * * Autocapturing navigation requires further configuration. See the [React Native SDK navigation docs](https://posthog.com/docs/libraries/react-native#capturing-screen-views) * for more information about autocapturing navigation. * * This is the recommended way to set up PostHog for React Native. This utilizes the Context API to pass the PostHog client around, enable autocapture. * * {@label Initialization} * * @example * ```jsx * // Add to App.(js|ts) * import { usePostHog, PostHogProvider } from 'posthog-react-native' * * export function MyApp() { * return ( * ', * }}> * * * ) * } * * // And access the PostHog client via the usePostHog hook * import { usePostHog } from 'posthog-react-native' * * const MyComponent = () => { * const posthog = usePostHog() * * useEffect(() => { * posthog.capture("event_name") * }, [posthog]) * } * * ``` * * @example * ```jsx * // Using with existing client * import { PostHog } from 'posthog-react-native' * * const posthog = new PostHog('', { * host: '' * }) * * export function MyApp() { * return ( * * * * ) * } * ``` * * @public * * @param props - The PostHogProvider props */ export declare const PostHogProvider: ({ children, client, options, apiKey, autocapture, style, debug, }: PostHogProviderProps) => JSX.Element | null;