javascript - TypeError:undefined 不是构造函数
问题描述
获取 TypeError:undefined 不是构造函数。
这是我的代码:
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { StackNavigator } from 'react-navigation';
import LoginScreen from './Screens/LoginScreen';
export default function App() {
return (
<View style={styles.container}>
<appStackNavigator />
</View>
);
}
const appStackNavigator = new StackNavigator({
Login: { Screen: LoginScreen },
});
const styles = StyleSheet.create({
container:
{
backgroundColor: '#AA00FF',
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});
这是我得到的错误:
TypeError:undefined is not a constructor(evaluating'new_reactNavigation.StackNavigator({Login:{Screen:_LoginScreen.LoginScreen}})')
请帮忙调试。
编辑:(帖子主要是代码,所以添加了一些支持问题的行)
解决方案
推荐阅读
- angular - 其属性仅在 TypeScript 中属于 A 和 B 类型的接口?
- ruby-on-rails - 将belongs_to 关联与匹配的has_many 配对总是最佳实践吗?
- mysql - Mysql更新记录数
- sorbet - 忽略冰糕中的一行
- memory - 全景游览的内存管理
- c - srand() 的种子,而不是 time() 和 getpid()
- gnuplot - 如何增加填充曲线绘图样式的关键符号?
- node.js - 节点 js 中的 Firebase 授权
- python - SymPy 不能很好地在终端中打印
- azure - Azure 数据工厂数据湖分析链接服务 - 由于连接方未正确响应而失败