【发布时间】:2019-06-21 13:35:09
【问题描述】:
我创建了一个空页面并尝试将另一个页面的组件导入到空页面中。
App.js
从 'react' 导入 React, {Component}; 从 './app.json' 导入 {name as appName};
进口{
View,
Text,
StyleSheet,
TextInput,
Button,
TouchableOpacity,
AppRegistry
} 来自'react-native';
从“./Login”导入登录;
函数验证() {
alert("Button Clicked...")
console.log("Hello world!")
}
导出默认类 App 扩展组件{
render(){
return(
<Login />
);
}
}
const 样式 = 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,
marginTop:45, 填充顶部:10, paddingBottom:10, 背景颜色:'#593eb2', 边界半径:10, 边框宽度:1, 边框颜色:'#fff' }, 登录文本:{ 颜色:'#fff', 文本对齐:'中心', 填充左:10, paddingRight : 10 }
})
登录.js
从 'react' 导入 React, {component}; 导入{
View,
TextInput,
StyleSheet
}来自'react-native';
导出默认类登录扩展组件{
render(){
return(
<View style = {styles.container}>
</View>
)
}
}
const 样式 = StyleSheet.create({
container: {background: "#44c41d", flex: 1}
})
错误
我刚刚开始使用 react-native 并且没有那么多知识。所以,请告诉我是否有人有任何解决方案。
提前致谢。
【问题讨论】:
标签: react-native-ios