鍍金池/ 問答/HTML5  HTML/ React Native在真機(jī)上運行報錯提示view config not fo

React Native在真機(jī)上運行報錯提示view config not found for name view?

在rn中自己寫了一個小頁面在真機(jī)運行報錯:Invariant Violation:view config not found for name view
下面是我的代碼:

import React,{ Component } from 'react';
import {
    View,
    Text,
    TextInput,
    Image,
    StyleSheet
} from 'react-native';

export default class Index extends Component{
    render(){
        return (
            <View style={styles.container}>
                <View style={styles.search}>
                    <TextInput placeholder="請輸入使用場所或賬號名稱" />
                    <Text>搜索</Text>
                </View>
                <View style={styles.category}>
                    <view style={styles.categoryList}>
                        <Image source={require('../images/all.png')} />
                        <Text>全部</Text>
                    </view>
                </View>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container:{
        padding:20
    },
    search:{
        flex:1,
        flexDirection: 'column'
    },
    category:{
        flex:1,
        flexDirection: 'column'
    },
    categoryList:{
        flex:1,
        flexDirection: 'row'
    }
});

我實在index.js中直接import我的代碼的,如下:

import { AppRegistry } from 'react-native';
// import App from './App';
import App from './app/pages/Index';

AppRegistry.registerComponent('PdBox', () => App);

下面是報錯信息截圖:
圖片描述

回答
編輯回答
紓惘

clipboard.png
你這里的"view"手寫字母要大寫,應(yīng)該是<View></View>

2017年8月19日 00:14
編輯回答
逗婦乳

是不是應(yīng)該寫成import Index from './app/pages/Index';

2017年10月28日 00:35