I'm new in react native development.I want to implement tabbar with stack navigator in react native.Tabbar shows proper. While tap on settingsscreen "Go Home" button not navigating to country screen.Its seems simple but since i am new i dont have much idea.
index.ios.js
import React, { Component } from 'react';
import { AppRegistry,View,Text } from 'react-native';
import MNavigator from './Components/MNavigator';
AppRegistry.registerComponent('*****', () => MNavigator);
MNavigator.js
import React, { Component } from 'react';
import {
Navigator,
} from 'react-native';
import {
TabNavigator,
} from 'react-navigation';
import { StackNavigator } from 'react-navigation';
import ArticleList from './ArticleList';
import SettingsScreen from './SettingsScreen';
export const MNavigator = TabNavigator({
ArticleList: {screen: ArticleList},
SettingsScreen: {screen: SettingsScreen},
})
export default MNavigator;
SettingsScreen.js
import React, { Component } from 'react';
import {
Image,
Text,
Button,
View
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import CountryScreen from './CountryScreen';
class SettingsScreen extends Component {
static navigationOptions = {
tabBarLabel: 'Settings',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: ({ tintColor }) => (
<Image
source={require('./img/like.png')}
style={[ {tintColor: tintColor}]}
/>
),
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Text>Hello, This is splash</Text>
<Button
onPress={() => this.props.navigation.navigate('CountryScreen', { user: 'Lucy' })}
title="Go Home"
/>
</View>
);
}
}
export default SettingsScreen;