Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 导入组件不工作_React Native - Fatal编程技术网

React native 导入组件不工作

React native 导入组件不工作,react-native,React Native,自定义组件 import React, { Component } from 'react' import { Text } from 'react-native' import { Content } from 'native-base' export default class Login extends Component { render () { return ( <Content> <Text>This is stat

自定义组件

import React, { Component } from 'react'
import { Text } from 'react-native'
import { Content } from 'native-base'

export default class Login extends Component {
  render () {
    return (
      <Content>
        <Text>This is stateless Component</Text>
      </Content>
    )
  }
}
index.ios.js

import React, { Component } from 'react'
import { AppRegistry, Text, View } from 'react-native'
import { Container, Header, Title, Content } from 'native-base'
import Login from './src/components/Login'

export default class MyApp extends Component {
  render () {
    return (
      <Container>
        <Header>
          <Title>Login</Title>
        </Header>
        <Login />
      </Container>
    )
  }
}

AppRegistry.registerComponent('MyApp', () => MyApp)
仅在running应用程序中显示标题。应为无状态组件不存在。有人能调查一下吗

您只能在容器组件中使用本机基组件:

从“React”导入React,{Component} 从“react native”导入{Text} 从“本机基”导入{Container,Content} 导出默认类登录扩展组件{ 渲染{ 回来 这是无状态组件 } }
试着放进一个包装里div@morne尝试不走运!你有错误吗?没有错误。它已成功构建并运行。自定义组件数据不存在…请尝试缩小问题的范围。比如说,删除内容组件,而只渲染文本组件。如果它确实渲染,则表示本机基本库有问题