mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
# Conflicts: # .github/workflows/check-insights-major-version.yml # .github/workflows/check-posthog-major-version.yml # .github/workflows/ci-security.yaml # .github/workflows/validate-versioning.yml # AGENTS.md # AGENTS.md~upstream_main # packages/ai/src/otel/capture.ts # packages/ai/src/otel/mappers/aiSdk.ts # packages/ai/src/otel/mappers/index.ts # packages/ai/src/otel/types.ts # packages/core/src/__tests__/posthog.init.spec.ts # packages/react-native/src/PostHogProvider.tsx # packages/react/src/context/PostHogContext.ts # packages/react/src/context/PostHogProvider.tsx # tooling/eslint-plugin-insights/no-unsafe-web-global.js
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
import { useFonts } from 'expo-font'
|
|
import { Stack } from 'expo-router'
|
|
import { StatusBar } from 'expo-status-bar'
|
|
import 'react-native-reanimated'
|
|
|
|
import { InsightsProvider, InsightsSurveyProvider } from 'insights-react-native'
|
|
|
|
import { useColorScheme } from '@/hooks/useColorScheme'
|
|
import { insights } from './insights'
|
|
|
|
export default function RootLayout() {
|
|
const colorScheme = useColorScheme()
|
|
const [loaded] = useFonts({
|
|
|
|
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
|
})
|
|
|
|
if (!loaded) {
|
|
// Async font loading only occurs in development.
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<InsightsProvider
|
|
client={insights}
|
|
autocapture={{
|
|
captureScreens: false, // expo-router requires this to be false and capture screens manually
|
|
captureTouches: true,
|
|
customLabelProp: 'ph-my-label',
|
|
}}
|
|
debug={true}
|
|
>
|
|
<InsightsSurveyProvider client={insights}>
|
|
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
|
<Stack>
|
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
<Stack.Screen name="surveys" options={{ title: 'Surveys' }} />
|
|
<Stack.Screen name="+not-found" />
|
|
</Stack>
|
|
<StatusBar style="auto" />
|
|
</ThemeProvider>
|
|
</InsightsSurveyProvider>
|
|
</InsightsProvider>
|
|
)
|
|
}
|