引用组件出错的问题?



  • 有个问题请教下
    我定义了一个 MyButton.js
    import React, {
    AppRegistry,
    Component,
    Image,View,
    TouchableHighlight,
    } from 'react-native';

    class MyButton extends React.Component {
    render() {
    return (
    <View bgColor='#000'>
    <Text>hello wrold</Text>
    </View>
    );
    }
    }
    export default MyButton;

    在index.ios.js中我进行这样操作,会报错
    'use strict'
    import React, { Component } from 'react';
    import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image, ListView
    } from 'react-native';

    import MyButton from './MyButton';
    。。。
    ![alt text](0_1470401357230_0AF44B73-9E04-4D29-8CEE-724E453633C6.png image url)


  • administrators

    报错已经清楚的给你指明了错误和修改方法

    react 和 react-native需要分开import


登录后回复