Chaitanya K
Chaitanya K

Reputation: 1852

React Native - Native Base - Showing error

This is the Package.Json File Following are package versions I am using

"dependencies": {
    "@expo/vector-icons": "^9.0.0",
    "expo": "^32.0.6",
    "native-base": "2.8.1",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-native-fontawesome": "^6.0.1",
    "react-navigation": "^3.3.0"
  },

This is My HearderPart.Js Component Code

I am unable to use native-base package in my component.

import {Container, Header, Content, Footer, Title} from 'native-base';
import React, {Component} from 'react-native';

export default class HeaderPart extends Component {
    render() {
        return (
            <Container>
                <Header>
                    <Title>Header</Title>
                </Header>
                <Content>
                    <Title>Content</Title> 
                </Content>
                <Footer>
                    <Title>Footer</Title>
                </Footer>
            </Container>
        );
    }
}
Error Message

enter image description here

Upvotes: 0

Views: 302

Answers (1)

Andrew
Andrew

Reputation: 28539

It seems that you are importing React from the wrong place. Currently in your HeaderPart component you are doing the following:

import React, {Component} from 'react-native';

You should be importing React like this:

import React, {Component} from 'react';

Importing React correctly should fix your issue.

Upvotes: 1

Related Questions