React Native在真机上运行报错提示view config not found for name view?

在rn中自己写了一个小页面在真机运行报错: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);

下面是报错信息截图:
图片描述

阅读 11k
2 个回答

clipboard.png
你这里的"view"手写字母要大写,应该是<View></View>

新手上路,请多包涵

是不是应该写成import Index from './app/pages/Index';

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题