React native 不变冲突反应本机
我的应用程序中有以下错误: 不变冲突:不变冲突:元素类型无效: 应为字符串(用于内置组件)或类/函数(用于 复合组件)但得到:未定义。你可能忘了出口 您的组件来自定义它的文件,或者您可能已经混合了 启动默认导入和命名导入 我不知道为什么这会发生在我身上,因为我没有看到任何问题。请看我的屏幕代码:React native 不变冲突反应本机,react-native,React Native,我的应用程序中有以下错误: 不变冲突:不变冲突:元素类型无效: 应为字符串(用于内置组件)或类/函数(用于 复合组件)但得到:未定义。你可能忘了出口 您的组件来自定义它的文件,或者您可能已经混合了 启动默认导入和命名导入 我不知道为什么这会发生在我身上,因为我没有看到任何问题。请看我的屏幕代码: import React, { Component } from 'react'; import { Text, View,StyleSheet,TouchableOpacity,TextInput,F
import React, { Component } from 'react';
import { Text, View,StyleSheet,TouchableOpacity,TextInput,FlatList,ListItem } from 'react-native';
import { Alert,Input } from 'native-base';
import {BoxShadow} from 'react-native-shadow';
import Dimensions from 'Dimensions';
import Icon from 'native-base';
const DEVICE_WIDTH = Dimensions.get('window').width;
export default class ticketDiaryHours1 extends Component {
constructor(props) {
super(props);
this.state = {
text: '',
textOpombe: '',
data: [
{key: 'Devin Dank'},
{key: 'Jackson Will'},
{key: 'James Jones'},
{key: 'Joel Noah'},
{key: 'John Degenkolb'},
{key: 'Jillian Calmejain'},
{key: 'Jimmy Butler'},
{key: 'Julie Hell'},
],
showList: false,
}
}
onShowStudent() {
if(this.state.showList) {
this.setState({
showList: false,
});
} else {
this.setState({
showList: true,
});
}
}
render() {
const shadowOpt = {
height:40,
width: DEVICE_WIDTH-40,
color:"#000",
border:2,
radius:8,
opacity:0.2,
x:0,
y:3,
style:{marginVertical:3}
};
const {
student,
startTime,
endTime,
headingText,
roomText,
apsent,
finished
} = this.props;
return (
<View style={styles.main}>
<Text>{startTime} - {endTime}</Text>
<Text style={styles.headingText}>{headingText} - {student}</Text>
<Text style={styles.hourContent}>VSEBINA URE </Text>
<BoxShadow setting={shadowOpt}>
<TextInput
style={styles.textInputStyle}
placeholder='Vnesite vsebino ure'
placeholderTextColor="rgba(0,0,0,0.5)"
onChangeText={(text) => this.setState({text})}
value={this.state.text}
underlineColorAndroid='transparent'
/>
</BoxShadow>
<Text style={styles.hourContent}>OPOMBE </Text>
<BoxShadow setting={shadowOpt}>
<TextInput
style={styles.textInputStyle}
placeholder='Vnesite opombe'
placeholderTextColor="rgba(0,0,0,0.5)"
onChangeText={(textOpombe) => this.setState({textOpombe})}
value={this.state.textOpombe}
underlineColorAndroid='transparent'
/>
</BoxShadow>
<View style={styles.markedRow}>
<View style={{flexDirection: 'column', justifyContent: 'center', justifyContent: 'flex-start' }}>
<Text style={styles.textIcon}>OPRAVLJENO</Text>
<TouchableOpacity
style={ [styles.touchable1, styles.iconStyle] }
onPress={this.onShowStudent.bind(this)}>
<Icon name='checkmark' style={{color: '#fff', fontSize: 20, alignSelf: 'center' }}/>
</TouchableOpacity>
</View>
<View style={{flexDirection: 'column', justifyContent: 'center', position: 'absolute', right: 0, top: 15 }}>
<Text style={styles.textIcon}>NEOPRAVLJENO</Text>
<TouchableOpacity
style={ [styles.touchable2, styles.iconStyle] }
onPress={this.onShowStudent.bind(this)}>
<Icon name='close'
style={{color: '#fff', fontSize: 20,alignSelf: 'center'}} />
</TouchableOpacity>
</View>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
main: {
paddingLeft: 20,
paddingRight: 20,
flexDirection: 'column',
paddingTop: 15
},
headingText: {
fontWeight: '400',
color: '#000000',
fontSize: 20,
},
hourContent: {
fontWeight: '400',
color: '#000000',
fontSize: 20,
paddingBottom: 15,
paddingTop: 15,
},
textInputStyle: {
backgroundColor: 'white',
paddingLeft: 10,
height: 40,
borderRadius: 8,
width: DEVICE_WIDTH-40,
},
markedRow: {
flexDirection: 'row',
paddingTop: 15,
},
touchable1: {
backgroundColor: '#48BFD3',
justifyContent: 'center',
},
touchable2: {
backgroundColor: '#EE9CA0',
justifyContent: 'center',
},
iconStyle: {
borderRadius: 8,
width: 50,
height: 40,
alignSelf: 'center',
},
textIcon: {
paddingBottom: 10,
fontWeight: '400',
color: '#000000',
fontSize: 20,
},
listItemStyle: {
flexDirection: 'row',
}
});
import React,{Component}来自'React';
从“react native”导入{文本、视图、样式表、TouchableOpacity、TextInput、FlatList、ListItem};
从“本机基”导入{Alert,Input};
从“react native shadow”导入{BoxShadow};
从“维度”导入维度;
从“本机基础”导入图标;
const DEVICE_WIDTH=维度.get('window').WIDTH;
导出默认类ticketDiaryHours1扩展组件{
建造师(道具){
超级(道具);
此.state={
文本:“”,
textOpombe:“”,
数据:[
{key:'Devin Dank'},
{键:'杰克逊将'},
{key:'詹姆斯·琼斯'},
{key:'Joel Noah'},
{key:'John Degenkolb'},
{key:'Jillian Calmejain'},
{key:'吉米·巴特勒'},
{key:'朱莉地狱'},
],
显示列表:错误,
}
}
onShowStudent(){
if(this.state.showList){
这是我的国家({
显示列表:错误,
});
}否则{
这是我的国家({
展示清单:没错,
});
}
}
render(){
常数shadowOpt={
身高:40,
宽度:设备_宽度-40,
颜色:“000”,
边界:2,
半径:8,
不透明度:0.2,
x:0,,
y:3,
样式:{margintical:3}
};
常数{
学生,
开始的时候,
(完),
标题文字,
roomText,
阿森特,
完成
}=这是道具;
返回(
{startTime}-{endTime}
{headingText}-{student}
维斯比纳酒店
this.setState({text})}
值={this.state.text}
“透明的”
/>
奥波姆贝
this.setState({textOpombe})}
值={this.state.textOpombe}
“透明的”
/>
奥普拉夫耶诺
新拉夫列诺
)
}
}
const styles=StyleSheet.create({
主要内容:{
paddingLeft:20,
paddingRight:20,
flexDirection:'列',
加油站:15
},
标题文字:{
fontWeight:'400',
颜色:'#000000',
尺寸:20,
},
小时内容:{
fontWeight:'400',
颜色:'#000000',
尺寸:20,
填充底部:15,
paddingTop:15,
},
文本输入样式:{
背景颜色:“白色”,
paddingLeft:10,
身高:40,
边界半径:8,
宽度:设备_宽度-40,
},
markedRow:{
flexDirection:'行',
paddingTop:15,
},
可触摸1:{
背景颜色:“#48BFD3”,
为内容辩护:“中心”,
},
可触摸2:{
背景颜色:“#EE9CA0”,
为内容辩护:“中心”,
},
iconStyle:{
边界半径:8,
宽度:50,
身高:40,
对齐自我:“中心”,
},
文本图标:{
填充底部:10,
fontWeight:'400',
颜色:'#000000',
尺寸:20,
},
listItemStyle:{
flexDirection:'行',
}
});
这是您导入的一个问题。尝试从“本机基”导入{Icon}代码>。这是一个成员导入(名为导入)。成员导入是使用导出…导出的,而不是导入时出现问题的导出默认…。尝试从“本机基”导入{Icon}代码>。这是一个成员导入(名为导入)。成员导入使用export…
导出,而不是export default…
尝试import{Icon}从'native base'导入代码>乐于帮助…投票并接受答案,因此这将有助于其他从“本机基础”中查找类似问题的人import{Icon}代码>乐意帮助…投票并接受答案,因此这将有助于寻找类似问题的其他人