11// @flow
22import React from 'react'
33import { StyleSheet , Platform , Dimensions } from 'react-native'
4- import { TabViewAnimated , TabBarTop } from 'react-native-tab-view'
4+ import { TabViewAnimated , TabBar } from 'react-native-tab-view'
55import * as c from '../colors'
66import type { TabbedViewPropsType } from './types'
7- import { TabbedViewPropTypes } from './types'
87import { tracker } from '../../../analytics'
98
109const styles = StyleSheet . create ( {
@@ -26,8 +25,6 @@ const styles = StyleSheet.create({
2625} )
2726
2827export default class TabbedView extends React . Component {
29- static propTypes = TabbedViewPropTypes
30-
3128 state = {
3229 index : 0 ,
3330 }
@@ -42,28 +39,20 @@ export default class TabbedView extends React.Component {
4239 }
4340
4441 _renderHeader = props => {
45- if ( this . props . tabs . length > 2 ) {
46- return (
47- < TabBarTop
48- { ...props }
49- scrollEnabled = { true }
50- indicatorStyle = { styles . indicator }
51- style = { styles . tabbar }
52- labelStyle = { styles . label }
53- />
54- )
55- } else {
56- return (
57- < TabBarTop
58- { ...props }
59- scrollEnabled = { true }
60- indicatorStyle = { styles . indicator }
61- style = { styles . tabbar }
62- labelStyle = { styles . label }
63- tabWidth = { Dimensions . get ( 'window' ) . width / 2 }
64- />
65- )
66- }
42+ const tabStyle = this . props . tabs . length <= 2
43+ ? { width : Dimensions . get ( 'window' ) . width / 2 }
44+ : undefined
45+
46+ return (
47+ < TabBar
48+ { ...props }
49+ scrollEnabled = { true }
50+ indicatorStyle = { [ styles . indicator ] }
51+ style = { styles . tabbar }
52+ labelStyle = { styles . label }
53+ tabStyle = { tabStyle }
54+ />
55+ )
6756 }
6857
6958 _renderScene = ( { route } ) => {
0 commit comments