练习tabbarios报错 求大神指导



  • 0_1468488973915_111.png

    • 下面是我的代码、、

    /**

    import React, { Component } from 'react';
    import {
    AppRegistry,
    StyleSheet,
    Text,
    PixelRatio,
    View,
    NavigatorIOS,
    ScrollView,
    TextInput,
    Image,
    TouchableOpacity,
    TabBarIOS,
    } from 'react-native';

    var Box = React.createClass({
    getInitialState:function() {
    return {
    tab: 'home'
    }

    },

    select:function(tabName) {
    this.setState({
    tab:tabName
    });
    },

    render: function() {
    return(
    <TabBarIOS style={styles.flex}>

        <TabBarIOS.Item 
        title='home' 
        icon = {require('image!tabbar_home')} 
        onPress = {this.select.bind(this,'home')} 
        selected = {this.state.tab === 'home'}>
          <ScrollView>
            <View style = {styles.home}>
              <Text style = {styles.home_title}>南山南</Text>
            </View>
          </ScrollView>  
        </TabBarIOS.Item> 
    
        <TabBarIOS.Item 
        title='message' 
        icon = {require('image!tabbar_message_center')} 
        onPress = {this.select.bind(this,'home')} 
        selected = {this.state.tab === 'home'}>
          <ScrollView>
            <View style = {styles.home}>
              <Text style = {styles.home_title}>南山南</Text>
            </View>
          </ScrollView> 
        </TabBarIOS.Item>
    
        <TabBarIOS.Item 
        title='discover' 
        icon = {require('image!tabbar_discover')} 
        onPress = {this.select.bind(this,'discover')} 
        selected = {this.state.tab === 'discover'}>
          <ScrollView>
            <View style = {styles.home}>
              <Text style = {styles.home_title}>南山南</Text>
            </View>
          </ScrollView> 
        </TabBarIOS.Item>
    
      </TabBarIOS>
      );
    

    }

    }) ;

    const styles = StyleSheet.create({
    flex:{
    flex:1,
    alignItems:'center'
    },
    home:{
    alignItems:'center',
    marginLeft:5,
    marginRight:5,
    },
    home_title:{
    fontSize:18,
    color:'#18B5FF',
    marginBottom:5,
    }
    });

    AppRegistry.registerComponent('Box', () => Box);


登录后回复