Javascript 未处理的JS异常:需要未知模块;9“;
所以我尝试设置登录屏幕的导航,我尝试重新链接依赖项并重新安装包,我只处理了两个文件。我正在MacOS上工作,并在iOS 13.5上进行模拟 App.jsJavascript 未处理的JS异常:需要未知模块;9“;,javascript,typescript,react-native,Javascript,Typescript,React Native,所以我尝试设置登录屏幕的导航,我尝试重新链接依赖项并重新安装包,我只处理了两个文件。我正在MacOS上工作,并在iOS 13.5上进行模拟 App.js import React, { Component } from 'react' import { StyleSheet, View } from 'react-native' import Mystack from './navigators/StackNavigator' export default class App ex
import React, { Component } from 'react'
import {
StyleSheet,
View
} from 'react-native'
import Mystack from './navigators/StackNavigator'
export default class App extends Component {
render() {
return (
<NavigationContainer>
<Mystack/>
</NavigationContainer>
)
}}
const styles = StyleSheet.create({
container: {
},
})
import React,{Component}来自“React”
进口{
样式表,
看法
}从“反应本机”
从“./navigators/StackNavigator”导入Mystack
导出默认类应用程序扩展组件{
render(){
返回(
)
}}
const styles=StyleSheet.create({
容器:{
},
})
和StackNavigator.js
import * as React from 'react';
import { createStackNavigator} from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';
import LogIn from './src/components/LogIn.js'
import SignUp from './src/components/SignUp.js'
import Dashboard from './src/components/Dashboard.js'
const Stack = createStackNavigator();
function Mystack() {
return(
<Stack.Navigator initialRouteName = "LogIn"
screenOptions = {{
headerTitleAlign: 'center',
HeaderStyle: {
backgroundColor: "#FFF700",
},
headerTintColor: '#FFF',
headerTitleStyle: {
fontWeight: 'bold',
},
}}>
<Stack.Screen name = "LogIn"
component = {LogIn}
options = {{
title: 'LogIn',
headerShown: false
}}/>
<Stack.Screen name = "SignUp"
component = {SignUp}
options = {{
title: 'SignUp',
headerShown: false
}}/>
<Stack.Screen name = "Dashboard"
component = {Dashboard}
options = {{
title: 'Dashboard'
}
}/>
</Stack.Navigator>
)
}
export default Mystack;
import*as React from'React';
从'@react navigation/stack'导入{createStackNavigator};
从'@react-navigation/native'导入{NavigationContainer};
从“./src/components/LogIn.js”导入登录名
从“./src/components/SignUp.js”导入注册
从“./src/components/Dashboard.js”导入仪表板
const Stack=createStackNavigator();
函数Mystack(){
返回(
)
}
导出默认Mystack;
我不确定这是不是合适的解决方案,但重启软件包对我来说很有效。你找到解决方案了吗?我也面临同样的问题。如果找到了解决方案,请告诉..我在重命名一些模块并移动到另一个目录时遇到了这个问题。重启metro服务器就足够了。