From c0c50d5f3906d6c474af178f62804f22677a6bae Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Fri, 15 May 2020 14:19:23 -0700 Subject: [PATCH] deps: Remove `react-navigation-tabs`. See the previous commit for the reason for the $FlowFixMe. In 0d2066f41, we followed a warning to use the `react-native-tabs` package: ``` console.warn node_modules/react-navigation/src/react-navigation.js:180 TabBarBottom is deprecated. Please use the react-navigation-tabs package instead: https://github.com/react-navigation/react-navigation-tabs ``` An important bit of context that's missing from this warning is that `react-navigation-tabs`'s function `createBottomTabNavigator`, specifically, is what replaces what was previously done with `TabBarBottom`. `react-navigation` also exports another function `createBottomTabNavigator`. So, is it so important to use the export from `react-navigation-tabs`? Turns out it's not; that function in `react-navigation` is an extremely thin wrapper on the one in `react-navigation-tabs`: In node_modules/react-navigation/src/react-navigation.js:69: ``` get createBottomTabNavigator() { return require('react-navigation-tabs').createBottomTabNavigator; }, ``` So, `react-navigation` depends on `react-navigation-tabs`, so we can remove the latter as a direct dependency in our project. The `react-navigation` v2 doc [1] also doesn't say anything about needing to depend directly on `react-navigation-tabs`. See also further discussion [2]. It would also have been possible to remove the direct dependency on `react-native-screens`, but we're planning to use that later; that's issue #4111. The same story applies to `createMaterialTopTabNavigator`. [1]: https://reactnavigation.org/docs/2.x/tab-based-navigation/ [2]: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/iOS.3A.20r-n-screens.20.2F.20r-n-document-picker/near/877185 --- package.json | 1 - src/main/MainTabs.js | 5 ++--- src/main/StreamTabs.js | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 607a722a839..9ad27adcb3b 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,6 @@ "react-native-webview": "^5.0.0", "react-navigation": "^2.18.3", "react-navigation-redux-helpers": "^2.0.9", - "react-navigation-tabs": "0.8.4", "react-redux": "^5.0.7", "react-test-renderer": "16.8.3", "redux": "^4.0.0", diff --git a/src/main/MainTabs.js b/src/main/MainTabs.js index 7c65c53785e..2c57a0fd0f0 100644 --- a/src/main/MainTabs.js +++ b/src/main/MainTabs.js @@ -1,7 +1,7 @@ /* @flow strict-local */ import React from 'react'; import { Platform } from 'react-native'; -import { createBottomTabNavigator } from 'react-navigation-tabs'; +import { createBottomTabNavigator } from 'react-navigation'; import type { TabNavigationOptionsPropsType } from '../types'; import tabsOptions from '../styles/tabs'; @@ -15,8 +15,7 @@ import IconUnreadConversations from '../nav/IconUnreadConversations'; import ProfileCard from '../account-info/ProfileCard'; export default createBottomTabNavigator( - // In the next commit, we'll activate this. - // £FlowFixMe `navigation` prop untyped on HomeTab, etc. + // $FlowFixMe `navigation` prop untyped on HomeTab, etc. { home: { screen: HomeTab, diff --git a/src/main/StreamTabs.js b/src/main/StreamTabs.js index 8bd2a072185..adc4037d109 100644 --- a/src/main/StreamTabs.js +++ b/src/main/StreamTabs.js @@ -2,7 +2,7 @@ import React from 'react'; import { StyleSheet, Text } from 'react-native'; import { FormattedMessage } from 'react-intl'; -import { createMaterialTopTabNavigator } from 'react-navigation-tabs'; +import { createMaterialTopTabNavigator } from 'react-navigation'; import type { TabNavigationOptionsPropsType } from '../types'; import tabsOptions from '../styles/tabs'; @@ -17,8 +17,7 @@ const styles = StyleSheet.create({ }); export default createMaterialTopTabNavigator( - // In the next commit, we'll activate this. - // £FlowFixMe `navigation` prop untyped on SubscriptionsCard, etc. + // $FlowFixMe `navigation` prop untyped on SubscriptionsCard, etc. { subscribed: { screen: SubscriptionsCard,