我正在构建一个React Native应用程序。..我似乎在渲染它时遇到了一些困难。

错误告诉我要检查“渲染方法”。

我不知道如何准确地检查这一点,但是根据我已经对此进行的研究,我确定这不是{}问题...

这是错误的屏幕截图,也是我的一些错误屏幕截图

以下是我用于index.ios.js的冗长代码(这是我正在编辑和添加代码的唯一位置)

 import React, { Component } from 'react'; import { AppRegistry,LayoutAnimation,StatusBar, StyleSheet,Image,ScrollView,ListView,Alert, Text,TouchableOpacity,TouchableHighlight, View,WebView,Dimensions,Platform,BackAndroid,ActivityIndicator } from 'react-native'; import { Container, Content, Footer, FooterTab, Button, Icon, Badge ,List, ListItem,Left, Body, Right , Spinner} from 'native-base'; import Share, {ShareSheet} from 'react-native-share'; import LinearGradient from 'react-native-linear-gradient'; import MaterialIcons from 'react-native-vector-icons/MaterialIcons'; import FontAwesome from 'react-native-vector-icons/FontAwesome'; import Entypo from 'react-native-vector-icons/Entypo'; const { width, height } = Dimensions.get("window"); const SideMenu = require('react-native-side-menu'); import {PullView} from 'react-native-pull'; import { AdMobBanner, AdMobInterstitial, PublisherBanner, AdMobRewarded } from 'react-native-admob'; // Variables var TopTitle = "YouTube"; var AppName = "YouTube"; var Subtitle = "My Tube App"; var webadress = 'https://www.youtube.com/'; var menupos = "left"; var slidemenu = true; var tabmenu = true; var spinercolor = "#C70000"; var foottexticon = "#FFFFFF"; var footbtncolor = "#E62117"; var footacrivebtncolor = "#CC181E"; var footupbar = "#CC181E"; var footmenu1 = ['th-large','Gallery','gallery','']; // icon-text-(web-gallery)-url var footmenu2 = ['music','Music','web','https://www.youtube.com/channel/UCZcLjfDvDHsa5EgXsY-63lQ']; var footmenu3 = ['smile-o','Funny','web','https://www.youtube.com/channel/UCaAZ2O-1wvipTqdbFv2cJJQ']; var footmenu4 = ['home','Home','web','https://www.youtube.com/']; var menutext = "#FFFFFF"; var menuicon = "#FFFFFF"; var menulinecolor = "#B20000"; var menubgcolor = "#333333"; var menuactivebgcolor = "#E62117"; var mencount = 4; var sidemenu1 = ['home','Home','https://www.youtube.com/']; // icon-text-url var sidemenu2 = ['user-md','Fitness','https://www.youtube.com/user/jlvi13']; var sidemenu3 = ['film','Trailers','https://www.youtube.com/user/movieclipsTRAILERS']; var sidemenu4 = ['feed','News','https://www.youtube.com/user/skynews']; var sidemenu5 = ['arrow-circle-o-up','my menu style','']; var sidemenu6 = ['trash-o','my menu style','']; var alertitle = "About my App"; var alertnt1 = "OK"; var alertext = "watch best channels in my UTUBE app"; var galleryk = "url"; // url-fullimage var gallery = [["https://yt3.ggpht.com/-sT1HsICSTxo/AAAAAAAAAAI/AAAAAAAAAAA/vIbnJ-_KKEE/s100-ck-no-mo-rj-c0xffffff/photo.jpg","https://www.youtube.com/channel/UCv9rbAUUpoW0k8MP2R4UEJA"],["https://yt3.ggpht.com/-NYvVdBecXao/AAAAAAAAAAI/AAAAAAAAAAA/5KhxX9EOzvk/s100-ck-no-mo-rj-c0xffffff/photo.jpg","https://www.youtube.com/user/aaronhipps"],["https://yt3.ggpht.com/-xjeq1t5vSyE/AAAAAAAAAAI/AAAAAAAAAAA/kboHvBqgdlo/s88-ck-no-mo-rj-c0xffffff/photo.jpg","https://www.youtube.com/channel/UCwgURKfUA7e0Z7_qE3TvBFQ"],["https://yt3.ggpht.com/-QeoyK0Cy9ik/AAAAAAAAAAI/AAAAAAAAAAA/BlMXwG9I_Q8/s88-ck-no-mo-rj-c0xffffff/photo.jpg","https://www.youtube.com/channel/UCoK5NOxkZBLfI_5eqf8Es4Q"],["https://yt3.ggpht.com/-6Zs1omhrM-E/AAAAAAAAAAI/AAAAAAAAAAA/Kf2Tfa9S2y0/s88-ck-no-mo-rj-c0xffffff/photo.jpg","https://www.youtube.com/channel/UCaXDyLT3Xs4p8B0B79GFZCQ"]]; var galleryrow = 3; // v 1.1 var showadv = false; // true-false var adid = "ca-app-pub-3940256099942544/1033173712"; // admob id var adbanner = false; // true-false var adinterstitial = false; // true-false var adinterstitialtime = 10; // check every : second adinterstitialtime = adinterstitialtime * 1000; var adinterstitialcount = 1; // how many times var adinterval = 0; export default class RedLine extends Component { constructor(props){ super(props); var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); console.disableYellowBox = true; this.state = { page:"splash", tpage:0, visible: false, dataSource: ds.cloneWithRows(gallery), cmenu1:false,cmenu2:false,cmenu3:false,cmenu4:false,cmenu5:false,cmenu6:false, isOpen:false,fullim:false, }; this.topIndicatorRender = this.topIndicatorRender.bind(this); if(adinterstitial && showadv){ setInterval(() => { if(adinterval < adinterstitialcount){ AdMobInterstitial.setAdUnitID(adid); //AdMobInterstitial.setTestDeviceID('EMULATOR'); AdMobInterstitial.requestAd(error => { AdMobInterstitial.showAd((error) => {}); }); } adinterval++; }, adinterstitialtime); } } renderRow(rowData: string, sectionID: number, rowID: number) { return ( <TouchableOpacity underlayColor='rgba(0,0,0,0)' style={{backgroundColor: '#FFF', width: width/galleryrow, height: width/galleryrow}} onPress={() => { if(galleryk == "url"){ webadress = rowData[1]; this.setState({tpage:0,kind:"web"}); } else if(galleryk == "fullimage"){ this.setState({fullimu:rowData[0],fullim:true}); } }} > <View> <Image style={{width: width/galleryrow, height: width/galleryrow}} source={{uri: rowData[0]}} ></Image> </View> </TouchableOpacity> ); } onPullRelease(resolve) { //do something this.myWebView.reload(); setTimeout(() => { resolve(); }, 3000); } onCancel() { console.log("CANCEL") this.setState({visible:false}); } onOpen() { console.log("OPEN") this.setState({visible:true}); } onNavigationStateChange(navState) { this.setState({ canGoBack: navState.canGoBack }); } onBack() { this.myWebView.goBack(); } componentWillMount () { BackAndroid.addEventListener('hardwareBackPress', this.backHandler); } componentWillUnmount () { BackAndroid.removeEventListener('hardwareBackPress', this.backHandler); } backHandler = () => { if(this.state.canGoBack){ this.onBack(); return true; } } topIndicatorRender(pulling, pullok, pullrelease) { const hide = {position: 'absolute', left: 10000}; const show = {position: 'relative', left: 0}; setTimeout(() => { if (pulling) { this.txtPulling && this.txtPulling.setNativeProps({style: show}); this.txtPullok && this.txtPullok.setNativeProps({style: hide}); this.txtPullrelease && this.txtPullrelease.setNativeProps({style: hide}); } else if (pullok) { this.txtPulling && this.txtPulling.setNativeProps({style: hide}); this.txtPullok && this.txtPullok.setNativeProps({style: show}); this.txtPullrelease && this.txtPullrelease.setNativeProps({style: hide}); } else if (pullrelease) { this.txtPulling && this.txtPulling.setNativeProps({style: hide}); this.txtPullok && this.txtPullok.setNativeProps({style: hide}); this.txtPullrelease && this.txtPullrelease.setNativeProps({style: show}); } }, 1); return ( <View style={{flexDirection: 'row', justifyContent: 'center', alignItems: 'center', height: 60}}> <ActivityIndicator size="small" color="gray" /> <Text ref={(c) => {this.txtPulling = c;}}> Pull Down to Refresh . . .</Text> <Text ref={(c) => {this.txtPullok = c;}}> Release to Refresh . . .</Text> <Text ref={(c) => {this.txtPullrelease = c;}}> Loading . . .</Text> </View> ); } render() { let shareOptions = { title: "React Native", message: "Hola mundo", url: "http://facebook.github.io/react-native/", subject: "Share Link" // for email }; let shareImageBase64 = { title: "React Native", message: "Hola mundo", url: REACT_ICON, subject: "Share Link" // for email }; if(this.state.page == "splash") { return( <View style={{flex:1,justifyContent: 'center', alignItems: 'center' , backgroundColor:"#E62117"}}> <View style={{justifyContent: 'center', alignItems: 'center' ,flex:0.7}}></View> <View style={{justifyContent: 'center', alignItems: 'center' ,flex:1}}> <Image onLayout={() => { setTimeout(() => { LayoutAnimation.easeInEaseOut(); this.setState({page:"home"}) }, 2000); }} style={{width: 0.4*width}} resizeMode={Image.resizeMode.contain} source={require('./files/logo.png')} /> </View> <View style={{justifyContent: 'center', alignItems: 'center' ,flex:0.7}}></View> </View> ); } var Spiner = (<View></View>); if(this.state.wload){ Spiner = (<Spinner style={{position:"absolute",bottom:75,left:width/2.2}} color={spinercolor} ></Spinner>); } var smenu1 = (<View></View>); var smenu2 = (<View></View>); var smenu3 = (<View></View>); var smenu4 = (<View></View>); var smenu5 = (<View></View>); var smenu6 = (<View></View>); if(mencount > 0){ smenu1 = (<TouchableOpacity onPress={() => { this.setState({cmenu1:true,cmenu2:false,cmenu3:false,cmenu4:false,cmenu5:false,cmenu6:false,}); webadress = sidemenu1[2]; this.setState({kind:"web"});this.setState({ isOpen: !this.state.isOpen, }); }} style={this.state.cmenu1 ? mclick() : midle()}> <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center" , fontWeight:"bold",marginRight:20}}>{sidemenu1[1]}</Text> <FontAwesome name={sidemenu1[0]} style={{fontSize:30, color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginLeft:20}} ></FontAwesome> </TouchableOpacity>); if(mencount > 1){ smenu2 = (<TouchableOpacity onPress={() => { this.setState({cmenu1:false,cmenu2:true,cmenu3:false,cmenu4:false,cmenu5:false,cmenu6:false,}); webadress = sidemenu2[2]; this.setState({kind:"web"});this.setState({ isOpen: !this.state.isOpen, }); }} style={this.state.cmenu2 ? mclick() : midle()}> <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center", fontWeight:"bold",marginRight:20}}>{sidemenu2[1]}</Text> <FontAwesome name={sidemenu2[0]} style={{fontSize:25, color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginLeft:20}} ></FontAwesome> </TouchableOpacity>); if(mencount > 2){ smenu3 = (<TouchableOpacity onPress={() => { this.setState({cmenu1:false,cmenu2:false,cmenu3:true,cmenu4:false,cmenu5:false,cmenu6:false,}); webadress = sidemenu3[2]; this.setState({kind:"web"});this.setState({ isOpen: !this.state.isOpen, }); }} style={this.state.cmenu3 ? mclick() : midle()}> <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center", fontWeight:"bold",marginRight:20}}>{sidemenu3[1]}</Text> <FontAwesome name={sidemenu3[0]} style={{fontSize:25, color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginLeft:20}} ></FontAwesome> </TouchableOpacity>); if(mencount > 3){ smenu4 = (<TouchableOpacity onPress={() => { this.setState({cmenu1:false,cmenu2:false,cmenu3:false,cmenu4:true,cmenu5:false,cmenu6:false,}); webadress = sidemenu4[2]; this.setState({kind:"web"});this.setState({ isOpen: !this.state.isOpen, }); }} style={this.state.cmenu4 ? mclick() : midle()}> <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center", fontWeight:"bold",marginRight:20}}>{sidemenu4[1]}</Text> <FontAwesome name={sidemenu4[0]} style={{fontSize:25, color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginLeft:20}} ></FontAwesome> </TouchableOpacity>); if(mencount > 4){ smenu5 = (<TouchableOpacity onPress={() => { this.setState({cmenu1:false,cmenu2:false,cmenu3:false,cmenu4:false,cmenu5:true,cmenu6:false,}); webadress = sidemenu5[2]; this.setState({kind:"web"});this.setState({ isOpen: !this.state.isOpen, }); }} style={this.state.cmenu5 ? mclick() : midle()}> <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center", fontWeight:"bold",marginRight:20}}>{sidemenu5[1]}</Text> <FontAwesome name={sidemenu5[0]} style={{fontSize:25, color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginLeft:20}} ></FontAwesome> </TouchableOpacity>); if(mencount > 5){ smenu6 = (<TouchableOpacity onPress={() => { this.setState({cmenu1:false,cmenu2:false,cmenu3:false,cmenu4:false,cmenu5:false,cmenu6:true,}); webadress = sidemenu6[2]; this.setState({kind:"web"});this.setState({ isOpen: !this.state.isOpen, }); }} style={this.state.cmenu6 ? mclick() : midle()}> <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center", fontWeight:"bold",marginRight:20}}>{sidemenu6[1]}</Text> <FontAwesome name={sidemenu6[0]} style={{fontSize:25, color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginLeft:20}} ></FontAwesome> </TouchableOpacity>); } } } } } } var smenu = (<View style={{backgroundColor:menubgcolor,marginTop:(Platform.OS === 'ios' && slidemenu ? 20 : 0)}} > <View style={{height:200,flexDirection:"column",justifyContent: 'center', backgroundColor:menubgcolor,borderBottomWidth:2 ,borderColor:menuactivebgcolor }}> <Image style={{width: 0.25*width , height:80, margin:10, alignSelf:"center" , textAlign:"center"}} resizeMode={Image.resizeMode.contain} source={require('./files/logo.png')} ></Image> <Text style={{ color:menutext , height:30 , alignSelf:"center" , textAlign:"center",marginTop:12 , fontWeight:"bold" }}>{AppName}</Text> <Text style={{ color:menutext , height:20 , alignSelf:"center" , textAlign:"center",marginTop:-6}}>{Subtitle}</Text> </View> {smenu1} {smenu2} {smenu3} {smenu4} {smenu5} {smenu6} <View style={{height:500, backgroundColor:menubgcolor}}> </View> {/*<TouchableOpacity onPress={()=>{ Share.open(shareOptions); }}> <View style={styles.instructions}> <Text>Simple Share</Text> </View> </TouchableOpacity>*/} </View>); var tmenu = (<View></View>); tmenu = ( <View style={{width:width,height:50,backgroundColor:menubgcolor,marginTop:(Platform.OS === 'ios' && slidemenu ? 20 : 0), flexDirection:(menupos=="left" ? "row" : "row-reverse") }}> <TouchableOpacity onPress={() => {this.setState({ isOpen: !this.state.isOpen, });}} style={{ backgroundColor:menubgcolor ,flex:1 , alignItems:"center", justifyContent:"center", flexDirection:"row"}} > <Entypo name="menu" style={{ color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginHorizontal:10, fontSize:30}} ></Entypo> </TouchableOpacity> <View style={{ backgroundColor:menuactivebgcolor ,flex:4 , alignItems:"center", justifyContent:"center", flexDirection:"row"}} > <Text style={{ color:menutext , flex:4 , alignSelf:"center" , textAlign:"center" , fontSize:20 , fontWeight:"bold"}}>{TopTitle}</Text> </View> <TouchableOpacity onPress={() => { Alert.alert( alertitle, alertext, [ {text: alertnt1, onPress: () => { } }, ], { cancelable: false } ) }} style={{ backgroundColor:menubgcolor ,flex:1 , alignItems:"center" , justifyContent:"center", flexDirection:"row"}} > <MaterialIcons name="info-outline" style={{ color:menuicon , flex:1, alignSelf:"center" , textAlign:"center",marginHorizontal:10, fontSize:28}} ></MaterialIcons> </TouchableOpacity> </View> ); var admob = (<View style={{height:0}}></View>); if(adbanner && showadv){ var admob = ( <View> <AdMobBanner style={{backgroundColor:"#fff"}} bannerSize="fullBanner" adUnitID={adid} testDeviceID="EMULATOR" didFailToReceiveAdWithError={this.bannerError} /> {/*<PublisherBanner bannerSize="fullBanner" adUnitID="ca-app-pub-3940256099942544/6300978111" testDeviceID="EMULATOR" didFailToReceiveAdWithError={this.bannerError} admobDispatchAppEvent={this.adMobEvent} />*/} </View> ); } var fmenu = (<View></View>); if(tabmenu){ var tmen1 = (<Button style={{backgroundColor:footbtncolor , height:60 , borderRadius:0}} onPress={() => {this.setState({tpage:1,kind:footmenu1[2]});webadress=footmenu1[3];}}> <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} name={footmenu1[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu1[1]}</Text> </Button>); var tmen2 = (<Button style={{backgroundColor:footbtncolor , height:60 , borderRadius:0}} onPress={() => {this.setState({tpage:2,kind:footmenu2[2]});webadress=footmenu2[3];}}> <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} name={footmenu2[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu2[1]}</Text> </Button>); var tmen3 = (<Button style={{backgroundColor:footbtncolor , height:60 , borderRadius:0}} onPress={() => {this.setState({tpage:3,kind:footmenu3[2]});webadress=footmenu3[3];}}> <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} name={footmenu3[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu3[1]}</Text> </Button>); var tmen4 = (<Button style={{backgroundColor:footbtncolor , height:60 , borderRadius:0}} onPress={() => {this.setState({tpage:4,kind:footmenu4[2]});webadress=footmenu4[3];}}> <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} name={footmenu4[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu4[1]}</Text> </Button>); if(this.state.tpage == 1) { tmen1 = (<Button style={{backgroundColor:footacrivebtncolor , height:60 , borderRadius:0}} active > <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} active name={footmenu1[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu1[1]}</Text> </Button>); } if(this.state.tpage == 2) { tmen2 = (<Button style={{backgroundColor:footacrivebtncolor , height:60 , borderRadius:0}} active > <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} active name={footmenu2[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu2[1]}</Text> </Button>); } if(this.state.tpage == 3) { tmen3 = (<Button style={{backgroundColor:footacrivebtncolor , height:60 , borderRadius:0}} active > <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} active name={footmenu3[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu3[1]}</Text> </Button>); } if(this.state.tpage == 4) { tmen4 = (<Button style={{backgroundColor:footacrivebtncolor , height:60 , borderRadius:0 }} active > <FontAwesome style={{color:foottexticon,fontSize:25,marginBottom:3}} active name={footmenu4[0]} ></FontAwesome> <Text style={{color:foottexticon}} >{footmenu4[1]}</Text> </Button>); } fmenu = (<View style={{width:width,height:60}}> <FooterTab style={{flex: 1,backgroundColor:"#fff" ,borderTopWidth:4 , borderColor:footupbar}}> {tmen1} {tmen2} {tmen3} {tmen4} </FooterTab> </View>); } var webview = ( <PullView topIndicatorRender={this.topIndicatorRender} onPullRelease={this.onPullRelease.bind(this)} style={{flex: 1,backgroundColor:"#FFF",marginTop:(Platform.OS === 'ios' && !slidemenu ? 20 : 0)}}> <WebView ref={myWebView => { this.myWebView = myWebView; }} source={{uri: webadress}} style={{width: width,height:height}} javaScriptEnabled={true} domStorageEnabled={true} onLoadStart={() => { this.setState({wload:true}); }} onLoadEnd={() => { this.setState({wload:false}); }} onNavigationStateChange= {this.onNavigationStateChange.bind(this)} renderError={() => { return ( <View style={{flex:1,alignItems:"center", justifyContent:"center",marginTop:50}}> <Text> No internet connection </Text> <Button style={{alignSelf:"center",marginTop:20}} onPress={() => {this.myWebView.reload()}} light><Text> Reload </Text></Button> </View> ) }} /> </PullView> ); var webviewback = (<View></View>); var fullimage = (<View></View>); if(this.state.kind == "gallery"){ webview = (<ListView style={{flex: 1, backgroundColor:"#fff",marginTop:(Platform.OS === 'ios' && !slidemenu ? 20 : 0) }} contentContainerStyle={{flexDirection: 'row', flexWrap: 'wrap'}} dataSource={this.state.dataSource} renderRow={this.renderRow.bind(this)} ></ListView>); if(this.state.fullim && galleryk == "fullimage"){ fullimage = (<View style={{width: width ,height:height ,position:"absolute",top:0,right:0,backgroundColor:"rgba(0, 0, 0 , 0.8)" ,}}> <Image style={{flex:1 , width: width , alignSelf:"center" , textAlign:"center"}} resizeMode={Image.resizeMode.contain} source={{uri: this.state.fullimu}} ></Image> <TouchableOpacity onPress={() => { this.setState({fullim: false})}} style={{width: width/9, alignItems:"center" , justifyContent:"center" ,height:width/9 ,position:"absolute",top:width/15 ,right:width/15 ,backgroundColor:"rgba(255, 255, 255 , 0.2)" ,borderRadius:width/18 , }}> <Entypo style={{color:foottexticon, alignSelf:"center" , fontSize:30, color:"rgba(255, 255, 255 , 0.6)" , marginTop:2}} active name="cross" ></Entypo> </TouchableOpacity> </View>); } }else{ webviewback = (<TouchableOpacity disabled={!this.state.canGoBack} onPress={this.onBack.bind(this)} style={{width: 45, alignItems:"center" , justifyContent:"center" ,height:45 , position:"absolute",bottom:width/3 ,right:-2 ,backgroundColor:"rgba(0, 0, 0 , 0.2)" ,borderRadius:2 }}> <Text style={{fontWeight:"bold" , fontSize:16 , color:"rgb(256, 256, 256 )"}} ><FontAwesome name="arrow-left" style={{fontSize:30, color:"#FFF" , flex:1, alignSelf:"center" , textAlign:"center"}} ></FontAwesome></Text> </TouchableOpacity>); } if(slidemenu){ return ( <SideMenu menu={smenu} menuPosition={menupos} isOpen={this.state.isOpen} onChange={(isOpen) => { this.setState({ isOpen, }); }} style={{marginTop:(Platform.OS === 'ios' && slidemenu ? 20 : 0)}} > <StatusBar backgroundColor="#000000" barStyle="default" ></StatusBar> <View style={styles.container}> {tmenu} {webview} {admob} {fmenu} {Spiner} {fullimage} {webviewback} </View> </SideMenu> ); }else{ return ( <View style={{flex: 1}}> <View style={styles.container}> {webview} {fmenu} {Spiner} {fullimage} </View> </View> ); } } } mclick = function(options) { if(menupos == "right"){ return { height:50, flexDirection:"row", justifyContent: 'center', backgroundColor:menuactivebgcolor, borderRightWidth:5 , borderColor:menulinecolor } }else{ return { height:50, flexDirection:"row-reverse", justifyContent: 'center', backgroundColor:menuactivebgcolor, borderLeftWidth:5 , borderColor:menulinecolor } } } midle = function(options) { if(menupos == "right"){ return { height:50, flexDirection:"row", justifyContent: 'center', backgroundColor:menubgcolor, } }else{ return { height:50, flexDirection:"row-reverse", justifyContent: 'center', backgroundColor:menubgcolor, } } } const styles = StyleSheet.create({ container: { flex: 1, //justifyContent: 'center', //alignItems: 'center', //backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, midle:{height:50,flexDirection:"row",justifyContent: 'center', backgroundColor:menubgcolor, }, mclick:{height:50,flexDirection:"row",justifyContent: 'center', backgroundColor:menuactivebgcolor, borderRightWidth:5 , borderColor:menulinecolor,}, }); AppRegistry.registerComponent('RedLine', () => RedLine); 

  ask by user1805060 translate from so

本文未有回复,本站智能推荐:

1回复

创建ReactNative应用程序时出错:元素类型无效:预期为字符串或类/函数,但得到了:对象

这似乎是一个以前提出的问题,但是到目前为止,我遇到的每个解决方案都是我的代码中已有的东西,或者是解决比我自己的代码库复杂得多的代码库的问题。 我要做的就是从React Native CLI生成的启动程序代码为我的应用程序创建一个中央入口点。 这是我到目前为止的内容: index.ios.
1回复

元素类型无效:预期为字符串或类/函数,但得到了:对象。

我在使用ReactIOS进行React Native工作时遇到了一些麻烦。 如果我将组件放在初始路径中就可以正常工作,但是如果尝试从另一个组件访问它,则会出现以下错误: 元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件),但得到:对象。 检查“ Navigator
1回复

元素类型无效:需要一个字符串(对于内置组件)或一个类/函数,但得到了:对象。

我知道这个问题已经被问过很多次了,但是我阅读的解决方案在我的情况下是行不通的。 我的代码非常简单明了: 我正在使用expo开发ios应用程序。 它一直显示元素类型无效:预期为字符串(对于内置组件)或类/函数,但得到了:对象。 您可能忘记了从定义文件中导出组件。 检查“ AwakeI
1回复

元素类型无效:预期为字符串或类/函数(对于复合组件),但得到了:对象

我正在React.js中做一些教程,对此我还很陌生。 我在dashboard.js中有此代码 有问题的代码行是这一行: 如果我将newChatFormbVisible:设置为false,则不会得到该错误,但是将其设置为true则会失败,并显示以下错误:- index.js:137
1回复

来自Facebook的ReactNativeNavigator示例代码失败:类型无效:预期为字符串(用于内置组件)或类/函数

相关/类似的问题正在犯一些简单的错误(属性的大小写不正确)等。我使用的代码是直接从React Native网站上提起的,因此可以肯定它应该工作。 我正在尝试使Navigator组件适应一个非常简单的现有应用程序。 我从React Native页面上的基本导航器开始: https : //f
4回复

React-NativeInvariantViolation:元素类型无效

当我要在我的iPhone Expo上运行我的反应本机应用程序时,此错误显示在红色背景区域中。 不变违规:元素类型无效:期望一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:object。 您可能忘记从其定义的文件中导出组件。 这是'src / components /'
2回复

不变违规:元素类型无效:预期为字符串或类/函数,但得到:对象

我知道这个问题,但似乎我的问题有所不同(即我认为导入结构不正确) 这是我得到的错误。 提到的文件位于react-native库的深处,不幸的是,该消息不是非常有用。 ExceptionsManager.js:73在renderApplication.js:35处检查代码。 不变
2回复

元素类型无效:预期为字符串或类/函数,但得到:对象

我试图共享相同的代码库,所以我将代码编写在index.js文件中,并将相同的代码放入index.ios.js和index.android.js文件中。 这是index.ios.js的代码: 这是index.js一些代码: