Trying to call the component class GlobalHeader
from a separate file.
Problem is, it won't display whenever it's in any other tag.
I've tried:
- Adding a
StyleSheet
withflex: 1
to theContainer
,Header
andGlobalHeader
- Removing
native-base
components and sticking withreact-native
components. - Toying around with
export default
(Doubt this is the problem) - Replacing the ES6
import
with NodeJSrequire
- Playing around with
GlobalHeader
's structure (Putting containers in it and the like)
I can successfully call and render it here:
If it's in another tag; yes, I've tried all sorts of tags:
Expected output (Yes, I know how to fix the icons):
Code for Details.js
:
import React, { Component } from 'react';
import { Container, Content, List, ListItem, Text, Header, Title, Button, Icon } from 'native-base';
import GlobalHeader from "../components/GlobalHeader";
export default class Details extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Container>
<GlobalHeader />
<Content>
<List dataArray={this.props.crate}
renderRow={(item) =>
<ListItem>
<Text>{item}</Text>
</ListItem>
}>
</List>
</Content>
</Container>
// <GlobalHeader />
);
}
}
module.exports = Details;
Code for GlobalHeader.js
:
import React, { Component } from 'react';
import { Container, Content, List, ListItem, Text, Header, Title, Button, Icon } from 'native-base';
export default class GlobalHeader extends Component {
constructor(props) {
super(props);
}
render() {
return (
<Header>
<Button transparent>
<Icon name='ios-arrow-back' />
</Button>
<Title>Header</Title>
<Button transparent>
<Icon name='ios-menu' />
</Button>
</Header>
);
}
}
module.exports = GlobalHeader;
Help would be much appreciated. Not changing my routes/navigator.
Only read about ES6 when I encountered this problem so it could be an ES6 problem?