I am currently working on an Expo project and encountered an issue when I execute the command npm run reset-project
, which results in a 500 error in my application. This error is linked to a file named missing-screen.tsx
. In this file, I have the following code:
import { StyleSheet } from 'react-native';
import { CustomText } from '@/components/CustomText';
import { CustomView } from '@/components/CustomView';
export default function MissingScreen() {
return (
<>
<Stack.Screen options={{ title: 'Error!' }} />
<CustomView style={styles.container}>
<CustomText type="header">This screen is unavailable.</CustomText>
<Link href="/" style={styles.link}>
<CustomText type="link">Return to the main screen!</CustomText>
</Link>
</CustomView>
</>
);
}
In the section where I have return (<>
, I receive a suggestion from VS to include import React from 'react'
. However, this leads to two additional errors regarding these imports:
import { CustomText } from '@/components/CustomText';
import { CustomView } from '@/components/CustomView';
I resolved the second import issue using ChatGPT by changing the path to '../components/CustomView';
. Now, when I want to import images, I must use source={require('@/image-path.jpg')}
. Can anyone clarify what’s happening here? Please note, I have only been working with React for three months, so I’d appreciate straightforward explanations.