Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native: add tamagui #3255

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/tlon-mobile/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ module.exports = mergeConfig(config, {
nodeModulesPaths: [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
// Tamagui packages expect to be able to require anything under the
// tamagui umbrella node_modules folder. Some modules fail to resolve
// without this.
path.resolve(workspaceRoot, 'node_modules/tamagui/node_modules'),
],
},
});
17 changes: 10 additions & 7 deletions apps/tlon-mobile/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
useNavigation,
} from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { TamaguiProvider } from '@tloncorp/ui';
import { PostHogProvider } from 'posthog-react-native';
import { useEffect, useState } from 'react';
import { Alert, StatusBar, Text, View } from 'react-native';
Expand Down Expand Up @@ -249,12 +250,14 @@ const App = ({ wer: initialWer }: Props) => {
export default function AnalyticsApp(props: Props) {
const isDarkMode = useIsDarkMode();
return (
<ShipProvider>
<NavigationContainer theme={isDarkMode ? DarkTheme : DefaultTheme}>
<PostHogProvider client={posthogAsync} autocapture>
<App {...props} />
</PostHogProvider>
</NavigationContainer>
</ShipProvider>
<TamaguiProvider>
<ShipProvider>
<NavigationContainer theme={isDarkMode ? DarkTheme : DefaultTheme}>
<PostHogProvider client={posthogAsync} autocapture>
<App {...props} />
</PostHogProvider>
</NavigationContainer>
</ShipProvider>
</TamaguiProvider>
);
}
8 changes: 8 additions & 0 deletions apps/tlon-mobile/src/tamagui.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { config } from '@tloncorp/ui';

export type Conf = typeof config;

// Sets up typing for tamagui so that theme variables autocomplete
declare module 'tamagui' {
interface TamaguiCustomConfig extends Conf {}
}
Loading
Loading