我创建了一个空页面,并尝试将另一个页面的组件导入到空页面中。
App.js
从‘react’导入React,{ appName};从‘./app.json’导入{name as app.json};
导入{
View,
Text,
StyleSheet,
TextInput,
Button,
TouchableOpacity,
AppRegistry}来自“react-native”;
导入登录自"./ Login ";
函数验证(){
alert("Button Clicked...")
console.log("Hello world!")}
导出默认类App扩展组件{
render(){
return(
<Login />
);
}}
常量样式= StyleSheet.create({
container: {
// justifyContent: 'center',
// alignItems: 'center',
backgroundColor: '#af522a',
flex: 1
},
txtText: {
textAlign: 'center',
fontSize: 25,
color: '#9daf2a'
},
txtInput: {
height: 45,
borderColor: '#9daf2a',
borderWidth: 3,
marginTop: 75,
padding: 12,
backgroundColor: '#FFFFFF',
marginLeft: 16,
marginRight: 16,
borderRadius: 15
},
txtInput2: {
height: 45,
borderColor: '#9daf2a',
borderWidth: 3,
padding: 12,
backgroundColor: '#FFFFFF',
marginLeft: 16,
marginRight: 16,
marginTop: 24,
borderRadius: 15
},
loginScreenButton:{
marginRight:40,
marginLeft:40,center:45,paddingTop: 10,paddingBottom:10,backgroundColor:'#593eb2',borderRadius:10,borderWidth: 1,borderColor:'#fff‘},loginText:{ loginText:’#fff‘,textAlign:'center',paddingLeft : 10,paddingRight :10}
})
Login.js
从‘react’导入React,{component};导入{
View,
TextInput,
StyleSheet}来自“react-native”;
导出默认类登录扩展组件{
render(){
return(
<View style = {styles.container}>
</View>
)
}}
常量样式= StyleSheet.create({
container: {background: "#44c41d", flex: 1}})
错误

我刚刚开始使用react-native,并没有太多的知识。所以,如果有人有任何解决方案,请告诉我。
提前谢谢。
发布于 2019-01-28 22:25:38
在Login.js中,您使用小写组件,
import React, {component} from 'react'将其转换为大写。
import React, {Component} from 'react'; https://stackoverflow.com/questions/54403863
复制相似问题