import { PureComponent, Component } from 'react' import { View, StyleSheet } from 'react-native' import { TabView, TabBar, SceneMap, TabBarProps, RouteBase, } from 'react-native-tab-view' const FirstRoute = () => ( ) class SecondRoute extends Component { render() { return ( ); } } class TabViewExample extends PureComponent { state: { index: number; routes: Array } = { index: 0, routes: [ { key: 'first', title: 'First' }, { key: 'second', title: 'Second' }, ], } _handleIndexChange = (index: number) => this.setState({ index }) _renderTabBar = (props: TabBarProps) => _renderScene = SceneMap({ first: FirstRoute, second: SecondRoute, }) render() { return ( ) } } const styles = StyleSheet.create({ container: { flex: 1, }, })