如何让反应导航在 IOS 和 Android 上表现相同

How to get react-navigation to behave the same on IOS and Android

我在我的应用程序上使用选项卡导航器进行导航,但它在 IOS 和 Android 上使用不同的 UI。有什么方法可以让它在 IOS 和 Android 上表现相同。或者除了反应导航之外,任何人都可以推荐任何其他库。

我正在努力使我的导航类似于 Instagram 应用程序 (https://www.sketchappsources.com/resources/source-images-plus1/instagram-ui-kit-kerroudj-1.jpg)

react-navigation 默认使用 TabBarBottom for iOS and TabBarTop for Android. If you want to use the same tabbar for both OS you can easily owerride this behavior with tabBarComponent 属性.

tabBarComponent - Component to use as the tab bar, e.g. TabBarBottom (this is the default on iOS), TabBarTop (this is the default on Android).

样本

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

export default TabNavigator(
  {
    Home: { screen: HomeScreen },
    Settings: { screen: SettingsScreen },
  },
  {
    tabBarComponent: TabBarBottom,
    tabBarPosition: 'bottom',
  }
);