0

I was doing the official Expo tutorial when I encountered a type error. I had a <Link> in my +not-found route that linked to the root directory. When I moved the routes into a route group called (tabs), the href gave this error:

Type '"/"' is not assignable to type"

Here is my +not-found.tsx:

import { View, StyleSheet } from 'react-native';
import { Link, Stack } from 'expo-router';

export default function NotFoundScreen() {
  return (
    <>
      <Stack.Screen options={{ title: 'Oops! Not Found' }} />
      <View style={styles.container}>
        <Link href="/" style={styles.button}>
          Go back to Home screen!
        </Link>
      </View>
    </>
  );
}

My root layout:

export default function RootLayout() {
  return (
    <Stack>
      <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
    </Stack>
  );
}

There is an index.tsx file in the (tabs) folder, and at runtime everything runs with no problem.

Any help understanding what's happening would be appreciated.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.