I just started to learning React Native and was following bunch of guides to implement the TabNavigator. However, it shows nothing in the Android Emulator. I am working on Windows environment.
The file structure looks like the following:
app/
-components/
-config/
--router.js
-Screens/
--Inbox/
---Inbox.js
--Account/
---Account.js
-Overview.js
I was trying to put all the navigation logic inside router.js file. The code looks like the following:
import React, {Component} from 'react';
import {TabNavigator, TabBarBottom} from 'react-navigation';
import {Icon} from 'react-native-elements';
import Login from '../Login/Login';
import Account from '../Screens/Account/Account';
import Inbox from '../Screens/Inbox/Inbox';
export const Tabs = TabNavigator({
Account: {
screen: Account,
navigationOptions: {
title: 'Account',
},
},
Inbox: {
screen: Inbox,
navigationOptions: {
title: 'Inbox',
},
},
},
{
tabBarComponent: TabBarBottom,
tabBarPosition: 'bottom',
});
Both Account.js and Inbox.js has some simple code to render a text:
import React, {Component} from 'react';
import {Text, View, StyleSheet} from 'react-native';
export default class Account extends Component{
render() {
return (
<View>
<Text>
This is Account Page.
</Text>
</View>
);
}
}
and index.android.js contains this:
import React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';
import Login from './app/component/Login/Login';
import Overview from './app/component/Overview';
export default class MyApp extends Component {
render() {
return (
<View>
<Overview />
</View>
);
}
}
AppRegistry.registerComponent('staging', () => MyApp);
and Overview.js:
import React, { Component } from 'react';
import {View, Container, Header, Content, Footer, FooterTab, Button, Text, Icon, Fab,} from 'native-base';
import {StyleSheet} from 'react-native';
import {Tabs} from './config/router';
import Login from './Login/Login';
class Overview extends Component{
render(){
return <Tabs />
}
}
export default Overview;
The Android Emulator shows absolutely nothing. And there is no build error. What am I doing wrong?