我正在使用试图构建底层Tab导航,但不确定是什么导致了错误,我使用了React Navigation6
App.js:
import React from 'react';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from '@react-navigation/native';
import BottomBar from './src/Navbar/BottomBar';
export default function App() {
  return(
      <NavigationContainer>
         <BottomBar/>
      </NavigationContainer>
  )
};错误:
Unable to resolve module src/Screens/Navigation/BottomNav from /Users/wafaturaifi/Desktop/Requests/App.js: src/Screens/Navigation/BottomNav could not be found within the project or in these directories:
  node_modules
If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*BottomBar.js:
import React, { useEffect, useContext } from "react";
import { View } from "react-native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import HomeScreen from '../Screens/Home';
import MoreScreen from '../Screens/More';
import PostScreen from '../Screens/Post';
import RequestsScreen from '../Screens/Requests';
import SummaryScreen from '../Screens/Summary';
const Tab = createBottomTabNavigator();
const BottomBar=() => {
  return (
    <Tab.Navigator>
      <Tab.Screen name="Home" component={HomeScreen} />
      <Tab.Screen name="Summary" component={SummaryScreen} />
      <Tab.Screen name="Add" component={AddScreen} />
      <Tab.Screen name="Requests" component={RequestsScreen} />
      <Tab.Screen name="More" component={MoreScreen} />
    </Tab.Navigator>
  );
}
export default BottomBar;档案结构:

发布于 2022-03-21 22:12:35
尝试以下步骤:
如果这些步骤没有解决问题,请您共享package.json。
https://stackoverflow.com/questions/71560069
复制相似问题