Skip to content

Commit

Permalink
MainTabs [nfc]: Prepare for and explain some FlowFixMes.
Browse files Browse the repository at this point in the history
The next commit's message is quite long, so here's the motivation
for the FlowFixMes.

Importing `createBottomTabNavigator` from `react-navigation` is good
because it means more type checking! Sadly, getting that to really
work in all the ways we want won't be easy.

To sum up, we could get *part* of the way there by making tweaks to
our typed `connect` (and making sure those tweaks didn't break
something or lose type-checking elsewhere!). But there's an
additional hurdle in something that's not quite right in the
`react-navigation` libdef.

The same goes for `createMaterialTopTabNavigator`.

Greg goes into more detail at the PR thread [1].

See also discussion [2].

[1]: zulip#4114 (comment)

[2]: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/react-navigation.20types/near/878259
  • Loading branch information
chrisbobbe committed Jun 4, 2020
1 parent 1f2657d commit fce0cea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/MainTabs.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,8 +15,10 @@ import IconUnreadConversations from '../nav/IconUnreadConversations';
import ProfileCard from '../account-info/ProfileCard';

export default createBottomTabNavigator(
// We'll activate these fixmes in the next commit.
{
home: {
// £FlowFixMe `navigationOptions` property on component type
screen: HomeTab,
navigationOptions: {
tabBarLabel: 'Home',
Expand All @@ -26,6 +28,8 @@ export default createBottomTabNavigator(
},
},
streams: {
// No fixme needed; StreamTabs is a navigator from
// `createMaterialTopTabNavigator`.
screen: StreamTabs,
navigationOptions: {
tabBarLabel: 'Streams',
Expand All @@ -35,6 +39,7 @@ export default createBottomTabNavigator(
},
},
conversations: {
// £FlowFixMe `navigationOptions` property on component type
screen: PmConversationsCard,
navigationOptions: {
tabBarLabel: 'Conversations',
Expand All @@ -44,6 +49,7 @@ export default createBottomTabNavigator(
},
},
settings: {
// £FlowFixMe `navigationOptions` property on component type
screen: SettingsCard,
navigationOptions: {
tabBarLabel: 'Settings',
Expand All @@ -53,6 +59,7 @@ export default createBottomTabNavigator(
},
},
profile: {
// £FlowFixMe `navigationOptions` property on component type
screen: ProfileCard,
navigationOptions: {
tabBarLabel: 'Profile',
Expand Down
3 changes: 3 additions & 0 deletions src/main/StreamTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ const styles = StyleSheet.create({
});

export default createMaterialTopTabNavigator(
// We'll activate these fixmes in the next commit.
{
subscribed: {
// £FlowFixMe `navigationOptions` property on component type
screen: SubscriptionsCard,
navigationOptions: {
tabBarLabel: (props: TabNavigationOptionsPropsType) => (
Expand All @@ -29,6 +31,7 @@ export default createMaterialTopTabNavigator(
},
},
allStreams: {
// £FlowFixMe `navigationOptions` property on component type
screen: StreamListCard,
navigationOptions: {
tabBarLabel: (props: TabNavigationOptionsPropsType) => (
Expand Down

0 comments on commit fce0cea

Please sign in to comment.