Skip to content

Commit b82a6b5

Browse files
committed
fix: expo example
1 parent 4b0165d commit b82a6b5

19 files changed

+100
-78
lines changed

apps/example-expo/app/(tabs)/explore.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { StyleSheet, Image } from 'react-native';
22

3-
import { Collapsible } from '@/components/Collapsible';
4-
import { ExternalLink } from '@/components/ExternalLink';
5-
import { ThemedText } from '@/components/ThemedText';
6-
import { ThemedView } from '@/components/ThemedView';
3+
import { Collapsible } from '../../components/Collapsible';
4+
import { ExternalLink } from '../../components/ExternalLink';
5+
import { ThemedText } from '../../components/ThemedText';
6+
import { ThemedView } from '../../components/ThemedView';
77
import { ScrollView } from 'react-native-gesture-handler';
88

99
function TabTwoScreen() {
@@ -46,7 +46,7 @@ function TabTwoScreen() {
4646
provide files for different screen densities
4747
</ThemedText>
4848
<Image
49-
source={require('@/assets/images/react-logo.png')}
49+
source={require('../../assets/images/react-logo.png')}
5050
style={{ alignSelf: 'center' }}
5151
/>
5252
<ExternalLink href="https://reactnative.dev/docs/images">

apps/example-expo/app/(tabs)/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ScrollView, StyleSheet, Platform } from 'react-native';
22

3-
import { ThemedText } from '@/components/ThemedText';
4-
import { ThemedView } from '@/components/ThemedView';
3+
import { ThemedText } from '../../components/ThemedText';
4+
import { ThemedView } from '../../components/ThemedView';
55

66
function HomeScreen() {
77
return (

apps/example-expo/app/+not-found.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Link, Stack } from 'expo-router';
22
import { StyleSheet } from 'react-native';
33

4-
import { ThemedText } from '@/components/ThemedText';
5-
import { ThemedView } from '@/components/ThemedView';
4+
import { ThemedText } from '../components/ThemedText';
5+
import { ThemedView } from '../components/ThemedView';
66

77
export default function NotFoundScreen() {
88
return (

apps/example-expo/app/_layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as SplashScreen from 'expo-splash-screen';
99
import { StatusBar } from 'expo-status-bar';
1010
import { useEffect } from 'react';
1111

12-
import { useColorScheme } from '@/hooks/useColorScheme';
12+
import { useColorScheme } from '../hooks/useColorScheme';
1313

1414
// Prevent the splash screen from auto-hiding before asset loading is complete.
1515
SplashScreen.preventAutoHideAsync();

apps/example-expo/babel.config.js

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
const path = require('path');
2-
const tabView = require('../../packages/react-native-bottom-tabs/package.json');
3-
const reactNavigationIntegration = require('../../packages/react-navigation/package.json');
2+
const fs = require('fs');
43

5-
module.exports = {
6-
presets: ['babel-preset-expo'],
7-
plugins: [
8-
[
9-
'module-resolver',
4+
const packages = path.resolve(__dirname, '..', '..', 'packages');
5+
6+
/** @type {import('@babel/core').TransformOptions} */
7+
module.exports = function (api) {
8+
api.cache(true);
9+
10+
const alias = Object.fromEntries(
11+
fs
12+
.readdirSync(packages)
13+
.filter((name) => !name.startsWith('.'))
14+
.map((name) => {
15+
const pak = require(`../../packages/${name}/package.json`);
16+
17+
if (pak.source == null) {
18+
return null;
19+
}
20+
21+
return [pak.name, path.resolve(packages, name, pak.source)];
22+
})
23+
.filter(Boolean)
24+
);
25+
26+
return {
27+
presets: ['babel-preset-expo'],
28+
overrides: [
1029
{
11-
extensions: ['.tsx', '.ts', '.js', '.json'],
12-
alias: {
13-
'react-native-bottom-tabs': path.join(
14-
__dirname,
15-
'../../packages/react-native-bottom-tabs',
16-
tabView.source
17-
),
18-
'@bottom-tabs/react-navigation': path.join(
19-
__dirname,
20-
'../../packages/react-navigation',
21-
reactNavigationIntegration.source
22-
),
23-
},
30+
exclude: /\/node_modules\//,
31+
plugins: [
32+
[
33+
'module-resolver',
34+
{
35+
extensions: ['.tsx', '.ts', '.js', '.json'],
36+
alias,
37+
},
38+
],
39+
],
2440
},
2541
],
26-
],
42+
};
2743
};

apps/example-expo/components/Collapsible.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { PropsWithChildren, useState } from 'react';
22
import { StyleSheet, TouchableOpacity } from 'react-native';
33

4-
import { ThemedText } from '@/components/ThemedText';
5-
import { ThemedView } from '@/components/ThemedView';
4+
import { ThemedText } from './ThemedText';
5+
import { ThemedView } from './ThemedView';
66

77
export function Collapsible({
88
children,

apps/example-expo/components/ThemedText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Text, type TextProps, StyleSheet } from 'react-native';
22

3-
import { useThemeColor } from '@/hooks/useThemeColor';
3+
import { useThemeColor } from '../hooks/useThemeColor';
44

55
export type ThemedTextProps = TextProps & {
66
lightColor?: string;

apps/example-expo/components/ThemedView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { View, type ViewProps } from 'react-native';
22

3-
import { useThemeColor } from '@/hooks/useThemeColor';
3+
import { useThemeColor } from '../hooks/useThemeColor';
44

55
export type ThemedViewProps = ViewProps & {
66
lightColor?: string;

apps/example-expo/hooks/useThemeColor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { useColorScheme } from 'react-native';
77

8-
import { Colors } from '@/constants/Colors';
8+
import { Colors } from '../constants/Colors';
99

1010
export function useThemeColor(
1111
props: { light?: string; dark?: string },

apps/example-expo/tsconfig.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
{
2-
"extends": "expo/tsconfig.base",
3-
"compilerOptions": {
4-
"strict": true,
5-
"paths": {
6-
"react-native-bottom-tabs": [
7-
"../../packages/react-native-bottom-tabs/src/index"
8-
],
9-
"react-native-bottom-tabs/react-navigation": [
10-
"../../packages/react-native-bottom-tabs/src/react-navigation/index"
11-
],
12-
"@/*": [
13-
"./*"
14-
]
2+
"extends": "../../tsconfig.json",
3+
"references": [
4+
{
5+
"path": "../../packages/react-native-bottom-tabs"
6+
},
7+
{
8+
"path": "../../packages/react-navigation"
159
}
10+
],
11+
"compilerOptions": {
12+
"rootDir": "."
1613
},
1714
"include": [
1815
"**/*.ts",

0 commit comments

Comments
 (0)