javascript - 无法解析模块“module://AssetRegistry.js”
问题描述
我有这个简单的零食博览会,直到两天前它都运行良好,但现在突然之间,它抛出了这个错误。我根本没有更改代码。我相信 package.json 文件出了点问题。
这是我的代码:(暂时省略样式表)
import React, { Component } from 'react';
import { Container, Header, Left, Body, Right, Button, Title, Text, Form, Item, Input, Label} from 'native-base';
import { StyleSheet, View} from 'react-native';
import { StackNavigator } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import { DrawerNavigator } from "react-navigation";
import { createAppContainer } from 'react-navigation';
export class Login extends Component {
constructor(props) {
super(props);
this.state = {
username: '',
password: '',
};
}
render() {
return (
<Container View style={styles.container}>
<Text View style={styles.title}>
My App</Text>
<Form View style={styles.formInput}>
<Item floatingLabel>
<Label View style={styles.labelText}>Username</Label>
<Input
View style={styles.textInput}
value={this.state.username}
onChangeText={username => this.setState({ username })}
placeholder={'Username'}
/>
</Item>
<Item floatingLabel last>
<Label View style={styles.labelText}>Password</Label>
<Input
View style={styles.textInput}
value={this.state.password}
onChangeText={password => this.setState({ password })}
placeholder={'Password'}
secureTextEntry={true}
/>
</Item>
</Form>
<Left>
<Button View style={styles.button}
onPress={() => this.props.navigation.navigate("Details")}>
<Text>Login</Text>
</Button>
<Text View style={styles.forgotText} >
Forgot Password?</Text>
</Left>
<Right>
<Button hasText transparent>
<Text
View style={styles.signupText}
>Don't have an account? Sign Up</Text>
</Button>
</Right>
</Container>
);
}
}
class DetailsScreen extends React.Component {
render() {
return (
<Text>Details Screen</Text>
);
}
}
const LoginRouter = createStackNavigator(
{
Home: { screen: Login },
Details: { screen: DetailsScreen },
}
)
export default createAppContainer(LoginRouter);
这是我的 Package.json 文件
{
"dependencies": {
"react-native-paper": "3.1.1",
"react-navigation-stack": "2.0.16",
"@react-native-community/masked-view": "^0.1.1",
"react-native-gesture-handler": "^1.5.0",
"react-native-safe-area-context": "^0.6.0",
"react-native-screens": "^2.0.0-alpha.20",
"react-navigation": "^4.0.10",
"native-base": "2.13.8"
}
}
解决方案
我也有同样的问题,看起来是零食的问题。在本地运行后,我的项目按预期工作。这是我在世博会论坛上打开的票的链接:https ://forums.expo.io/t/module-assetregistry-js/32650
推荐阅读
- android - 如何从firebase数据库android中的Parent获取子节点名称?
- javascript - 在 React 中的字符串内渲染 HTML 实体
- azure-devops - 创建故事或错误时 - 我如何强制创建者将父链接添加到工作项
- c# - 如何将 .xaml 文件中的标签与 .cs 文件中的字符串对象绑定
- python - Django - For 循环只为一项提供结果
- android - 如何使任何图像内的字段可编辑?
- javascript - 激活 document.body.contentEditable 时如何记录更改
- c++ - 比较类和对象的向量时如何定义 == 运算符?
- c# - 如何拆分保留换行符的文本文件
- perl - 为什么Perl编程的“7.2.39 IPC::Open2”中显示的程序实际上结束了?