TypeError: undefined is not a function (near '...(0, _reactNavigationTabs.createBottomTapNavigator)...')
TypeError: undefined is not a function (near '...(0, _reactNavigationTabs.createBottomTapNavigator)...')
嗨,我一直弹出这个错误:
TypeError: undefined 不是一个函数(靠近'...(0, _reactNavigationTabs.createBottomTapNavigator)...')
在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 在 reportException
在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 在 handleException
在 node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 在 handleError
在 node_modules/@react-native/polyfills/error-guard.js:49:36 在 ErrorUtils.reportFatalError
在 guardedLoadModule 中的 node_modules/metro-runtime/src/polyfills/require.js:204:6
在 http://10.0.5.48:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:165799:3 全球代码
不变违规:“main”尚未注册。如果出现以下情况,就会发生这种情况:
- Metro(本地开发服务器)运行 来自错误的文件夹。检查 Metro 是否 运行ning,停止它并在当前项目中重新启动它。
- 一个模块由于错误而未能加载并且
AppRegistry.registerComponent
没有被调用。
在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 在 reportException
在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 在 handleException
在 node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 在 handleError
在 node_modules/@react-native/polyfills/error-guard.js:49:36 在 ErrorUtils.reportFatalError
我的 App.js 看起来像这样:
import React from "react";
import { createAppContainer, createSwitchNavigator } from 'react-navigation'
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTapNavigator } from 'react-navigation-tabs';
import AccountScreen from "./src/screens/AccountScreen";
import SignInScreen from "./src/screens/SignInScreen";
import SignUpScreen from "./src/screens/SignUpScreen";
import TrackCreateScreen from "./src/screens/TrackCreateScreen";
import TrackDetailScreen from "./src/screens/TrackDetailScreen.js";
import TrackListScreen from "./src/screens/TrackListScreen";
const switchNavigator = createSwitchNavigator(
{
loginFLow: createStackNavigator({
SignUp: SignUpScreen,
SignIn: SignInScreen
}),
mainFlow: createBottomTapNavigator({
trackListFlow: createStackNavigator({
TrackList: TrackListScreen,
TrackDetail: TrackDetailScreen
}),
TrackCreate: TrackCreateScreen,
Account: AccountScreen
})
}
)
export default createAppContainer(switchNavigator)
这是我的 package.json:
{
"name": "tracks",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.11",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/stack": "^6.1.1",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-navigation-tabs": "^2.11.2"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
我正在使用博览会。这是由于语法过时还是有人知道问题出在哪里?
我安装了所有依赖项并查看了文档,但没有找到任何东西
有许多与您的项目关联的不同缓存可以阻止您的项目 运行 按预期进行。清除缓存有时可以帮助您解决与陈旧或损坏数据相关的问题,并且在故障排除和调试时通常很有用。
使用它来清除您的项目缓存:
expo r -c
您可以在此处阅读更多信息:
这是一个拼写错误。应该是:
createBottomTabNavigator
而不是:
createBottomTapNavigator
嗨,我一直弹出这个错误:
TypeError: undefined 不是一个函数(靠近'...(0, _reactNavigationTabs.createBottomTapNavigator)...') 在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 在 reportException 在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 在 handleException 在 node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 在 handleError 在 node_modules/@react-native/polyfills/error-guard.js:49:36 在 ErrorUtils.reportFatalError 在 guardedLoadModule 中的 node_modules/metro-runtime/src/polyfills/require.js:204:6 在 http://10.0.5.48:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:165799:3 全球代码
不变违规:“main”尚未注册。如果出现以下情况,就会发生这种情况:
- Metro(本地开发服务器)运行 来自错误的文件夹。检查 Metro 是否 运行ning,停止它并在当前项目中重新启动它。
- 一个模块由于错误而未能加载并且
AppRegistry.registerComponent
没有被调用。 在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 在 reportException 在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 在 handleException 在 node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 在 handleError 在 node_modules/@react-native/polyfills/error-guard.js:49:36 在 ErrorUtils.reportFatalError
我的 App.js 看起来像这样:
import React from "react";
import { createAppContainer, createSwitchNavigator } from 'react-navigation'
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTapNavigator } from 'react-navigation-tabs';
import AccountScreen from "./src/screens/AccountScreen";
import SignInScreen from "./src/screens/SignInScreen";
import SignUpScreen from "./src/screens/SignUpScreen";
import TrackCreateScreen from "./src/screens/TrackCreateScreen";
import TrackDetailScreen from "./src/screens/TrackDetailScreen.js";
import TrackListScreen from "./src/screens/TrackListScreen";
const switchNavigator = createSwitchNavigator(
{
loginFLow: createStackNavigator({
SignUp: SignUpScreen,
SignIn: SignInScreen
}),
mainFlow: createBottomTapNavigator({
trackListFlow: createStackNavigator({
TrackList: TrackListScreen,
TrackDetail: TrackDetailScreen
}),
TrackCreate: TrackCreateScreen,
Account: AccountScreen
})
}
)
export default createAppContainer(switchNavigator)
这是我的 package.json:
{
"name": "tracks",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.11",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/stack": "^6.1.1",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-navigation-tabs": "^2.11.2"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
我正在使用博览会。这是由于语法过时还是有人知道问题出在哪里?
我安装了所有依赖项并查看了文档,但没有找到任何东西
有许多与您的项目关联的不同缓存可以阻止您的项目 运行 按预期进行。清除缓存有时可以帮助您解决与陈旧或损坏数据相关的问题,并且在故障排除和调试时通常很有用。
使用它来清除您的项目缓存:
expo r -c
您可以在此处阅读更多信息:
这是一个拼写错误。应该是:
createBottomTabNavigator
而不是:
createBottomTapNavigator