Title和tabBarIcon均未在react-native

时间:2018-07-23 11:24:29

标签: javascript reactjs react-native react-navigation

我正在使用本机开发。 我曾经使用tabNavigator进行导航。但是现在不推荐使用。所以我使用的是createMaterialBottomTabNavigator,其中出现了问题,例如标签栏底部的标题和图标似乎没有显示等。

import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import { createStackNavigator } from 'react-navigation';
import { Image } from 'react-native';

const Inside = createMaterialBottomTabNavigator({
      Home: {
         screen: Home,
         navigationOptions: {
               headerLeft: null,
               headerTitle: "something", // I used everything like headerText
                                         // title, title as obj etc.
      }

        tabBarIcon: ({tintColor}) => {
            return <Image
                source={require('./Images/tabs/home.png')}
                style={{ height: 35, width: 35, tintColor: tintColor 
    }}
                resizeMode='contain'
            />; // Image does not show up.
        },
        inactiveTintColor: '#3e2465',
        activeTintColor: '#f0edf6',
      },

      Search: {
          screen: Search,
          navigationOptions: {
            header: {
                visible: true //It doesn't work as well
            }},

      },
  {
    tabBarOptions: {
        showIcon: true
  }
}
       // other screens...
    })

这可以在createStackNavigator中起作用

const App = createStackNavigator({
Welcome: {
    screen: Welcome,
    navigationOptions: {
        headerTitle: 'Bluebird', //its working
    },
},
Login: {
    screen: Login
},
 Inside: {
    screen: Inside
},

0 个答案:

没有答案