我在索引页面中调用了Trafik.js,但它没有运行,我错了,我不知道为什么......
元素类型无效:期望一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:object。检查query = session.createQuery("delete from Employee where id = :eid");
query.setInteger("eid", 4);
result = query.executeUpdate();
System.out.println("Employee deleted successfully " + result);
tx.commit(); // commit the transaction
session.close(); // close the session
factory.close(); // close the factory
的呈现方法。
1-index.android.js
dene1
2.trafik.js
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableHighlight,
Navigator
} from 'react-native';
import Trafik from './Trafik'
var dene1 = React.createClass({
render : function(){
return <View style = {[style.container,this.border('red')]} >
{this.header()}
{this.middle()}
{this.footer()}
<Trafik/>
</View>
}, //render
header:function(){
return <View style = {[style.header,this.border('yellow')]}>
<View style={[style.teklifBtn,this.border('blue')]}>
<Text>
Teklifler
</Text>
</View>
<View style={[style.mesajBtn,this.border('blue')]}>
<Text>
Mesajlar
</Text>
</View>
</View>
},
middle:function(){
return <View style = {[style.middle,this.border('green')]}>
<Text>
middle
</Text>
</View>
},
footer:function(){
return <View style = {[style.footer,this.border('black')]}>
<TouchableHighlight style={[style.kaskoBtn,this.border('blue')]}>
<Text>
kasko
</Text>
</TouchableHighlight>
<TouchableHighlight underlayColor='red' style={[style.trafikBtn,this.border('blue')]}>
<Text>
trafik
</Text>
</TouchableHighlight>
<TouchableHighlight style={[style.yanginBtn,this.border('blue')]}>
<Text>
yangin
</Text>
</TouchableHighlight>
<TouchableHighlight style={[style.seyahatBtn,this.border('blue')]}>
<Text>
seyahat
</Text>
</TouchableHighlight>
</View>
},
border:function(color){
return {
borderColor : color,
borderWidth: 4
}
},
}) ;//dene1
var style = StyleSheet.create({
container :{
flex:1,
},
header : {
flex :0.9,
flexDirection:'row',
},
middle : {
flex :3,
flexDirection:'row',
justifyContent:'center',
alignItems: 'center',
},
footer:{
flex :4,
flexDirection:'column',
},
teklifBtn:{
flex :1,
justifyContent:'center',
alignItems: 'center',
backgroundColor:'red'
},
mesajBtn:{
flex :1,
justifyContent:'center',
alignItems: 'center',
},
kaskoBtn:{
flex :1,
justifyContent:'center',
alignItems: 'center',
},
trafikBtn:{
flex :1,
justifyContent:'center',
alignItems: 'center',
},
yanginBtn:{
flex :1,
justifyContent:'center',
alignItems: 'center',
},
seyahatBtn:{
flex :1,
justifyContent:'center',
alignItems: 'center',
},
})
AppRegistry.registerComponent('dene1', () => dene1);
答案 0 :(得分:1)
在Trafik.js最后一行替换中尝试此操作 module.export = Trafik; 同 出口默认Trafik;