2017-10-14 5 views
0

TabNavigator에 아이콘이 표시되지 않습니다. 내 코드 :TabNavigator에 아이콘이 표시되지 않습니다.

import React, { Component } from 'react'; 
import { AppRegistry, Text, View } from 'react-native'; 

import { StackNavigator,TabNavigator } from 'react-navigation'; 


import TestComp1 from './src/components/TestComp1' 
import TestComp2 from './src/components/TestComp2' 
import TestComp3 from './src/components/TestComp3' 
import TestComp4 from './src/components/TestComp4' 
import TestComp5 from './src/components/TestComp5' 

export default class myApp extends Component { 
    render() { 
    return (

     <MyApp /> 

    ); 
    } 
} 

const Tabs = TabNavigator({ 
    TestComp3: {screen:TestComp3}, 
    TestComp4: { 
    screen:TestComp4, 
    navigationOptions: ({ navigation }) => ({ 
     title: "TestComp4", 
     tabBarIcon: ({ tintColor, focused }) => <View><MaterialIcons name="accessibility" size={20}/></View> 
     }) 
    } 
}, { 

    tabBarPosition: 'bottom', 

    tabBarOptions: { 
    activeTintColor: '#e91e63', 
    inactiveBackgroundColor: 'green', //This doesn't work 
    }, 
}); 

const MyApp = StackNavigator({ 
    TestComp: {screen:TestComp1}, 
    TestComp2: {screen:TestComp2}, 
    Tabs: { 
    screen: Tabs 
    } 
}, { 
    initialRouteName: "Tabs" 
}); 

AppRegistry.registerComponent('MyApp',() => MyApp); 

레이블은 TestComp4에 대한 표시되어 있지만 아이콘이 표시되지 않습니다. 클릭시 색상을 표시하고 변경하는 아이콘은 어떻게 얻을 수 있습니까?

레이블이 TestComp4인데 아이콘이 보이지 않습니다. 클릭시 색상을 표시하고 변경하는 아이콘은 어떻게 얻을 수 있습니까?

+0

당신이 어떤 플랫폼에 테스트? –

+0

나는 안드로이드에서 테스트 중이다 – Somename

+0

아이콘을 설정하려고 시도한다. 굴곡부를 1로보고 배경색을 적용하여 탭을 채우는 지 확인한다. –

답변

0

는 너무 같은 showIcon: true을 설정, 문제를 찾았습니다

tabBarOptions: { 
    showIcon: true 
}