diff --git a/package.json b/package.json index 8b474b402d..1d5cf4db29 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "6.0.0", "@react-native-community/push-notification-ios": "^1.5.0", - "@react-navigation/bottom-tabs": "npm:@zulip/react-navigation-bottom-tabs@5.11.16-0.zulip.1", + "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/material-top-tabs": "^6.6.13", "@react-navigation/native": "^5.7.6", "@react-navigation/stack": "npm:@zulip/react-navigation-stack@5.14.10-0.zulip.1", diff --git a/src/main/MainTabsScreen.js b/src/main/MainTabsScreen.js index cb8ccb85b9..9987a2ee08 100644 --- a/src/main/MainTabsScreen.js +++ b/src/main/MainTabsScreen.js @@ -10,7 +10,7 @@ import type { RouteProp, RouteParamsOf } from '../react-navigation'; import { getUnreadHuddlesTotal, getUnreadPmsTotal } from '../selectors'; import { useSelector } from '../react-redux'; import type { AppNavigationMethods, AppNavigationProp } from '../nav/AppNavigator'; -import { bottomTabNavigatorConfig } from '../styles/tabs'; +import { bottomTabNavOptions } from '../styles/tabs'; import HomeScreen from './HomeScreen'; import PmConversationsScreen from '../pm-conversations/PmConversationsScreen'; import { IconInbox, IconStream, IconPeople } from '../common/Icons'; @@ -53,7 +53,7 @@ export default function MainTabsScreen(props: Props): Node { return ( - + ({ - tabBarOptions: { - // TODO: Find a way to tell if we're on an Android tablet, - // and use that -- we don't want to assume Android users - // aren't on tablets, but `isPad` is iOS only and `Platform` - // doesn't have something else for Android (yet): - // https://reactnative.dev/docs/platform#ispad-ios - showLabel: Platform.OS === 'ios' && Platform.isPad, +export const bottomTabNavOptions = (): BottomTabNavigationOptions => ({ + headerShown: false, + lazy: false, - activeTintColor: BRAND_COLOR, - inactiveTintColor: 'gray', - labelStyle: { - fontSize: 13, - margin: 0, - }, - tabStyle: { - flex: 1, - }, - style: { - backgroundColor: 'transparent', + // TODO: Find a way to tell if we're on an Android tablet, + // and use that -- we don't want to assume Android users + // aren't on tablets, but `isPad` is iOS only and `Platform` + // doesn't have something else for Android (yet): + // https://reactnative.dev/docs/platform#ispad-ios + tabBarShowLabel: Platform.OS === 'ios' && Platform.isPad, - // Fix a bug introduced in React Navigation v5 that is exposed - // by setting `backgroundColor` to 'transparent', as we do. - elevation: 0, - }, + tabBarActiveTintColor: BRAND_COLOR, + tabBarInactiveTintColor: 'gray', + tabBarLabelStyle: { + fontSize: 13, + margin: 0, + }, + tabBarItemStyle: { + flex: 1, + }, + tabBarStyle: { + backgroundColor: 'transparent', + + // Fix a bug introduced in React Navigation v5 that is exposed + // by setting `backgroundColor` to 'transparent', as we do. + elevation: 0, }, }); diff --git a/tools/tsflower b/tools/tsflower index 80fe783b87..1e042d93b9 100755 --- a/tools/tsflower +++ b/tools/tsflower @@ -194,7 +194,7 @@ run_only() run_on_package "${package}" format_dir "${rootdir}"/types/"${package}" - for package in @react-navigation/{routers,core,native,stack,bottom-tabs,material-top-tabs}; do + for package in @react-navigation/{routers,core,elements,native,stack,bottom-tabs,material-top-tabs}; do run_on_package "${package}" # TODO(tsflower): skip node_modules when acting on package, # so we don't have to delete it here diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/index.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/index.js.flow index 9e24658413..9acea5ad9f 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/index.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/index.js.flow @@ -2,15 +2,17 @@ * @generated by TsFlower */ export { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator'; -export { default as BottomTabView } from './views/BottomTabView'; export { default as BottomTabBar } from './views/BottomTabBar'; +export { default as BottomTabView } from './views/BottomTabView'; +export { default as BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext'; export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext'; export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight'; export { + BottomTabBarButtonProps, + BottomTabBarProps, + BottomTabHeaderProps, + BottomTabNavigationEventMap, BottomTabNavigationOptions, BottomTabNavigationProp, BottomTabScreenProps, - BottomTabBarProps, - BottomTabBarOptions, - BottomTabBarButtonProps, } from './types'; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow index 82a8615813..ebf13d3dca 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow @@ -1,5 +1,31 @@ /* @flow * @generated by TsFlower */ -declare var _default: any; +import type { TypedNavigator as $tsflower_import_type$_$_40_react_2d_navigation_2f_native$TypedNavigator } from '@react-navigation/native'; +import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; + +import { + type DefaultNavigatorOptions, + type ParamListBase, + type TabNavigationState, + type TabRouterOptions, +} from '@react-navigation/native'; + +import { + type BottomTabNavigationConfig, + type BottomTabNavigationEventMap, + type BottomTabNavigationOptions, +} from '../types'; + +type Props = TabRouterOptions & BottomTabNavigationConfig; +declare function BottomTabNavigator(Props): $tsflower_subst$React$JSX$Element; +declare var _default: < + ParamList: ParamListBase, +>() => $tsflower_import_type$_$_40_react_2d_navigation_2f_native$TypedNavigator< + ParamList, + TabNavigationState, + BottomTabNavigationOptions, + BottomTabNavigationEventMap, + typeof BottomTabNavigator, +>; export default _default; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow index 03dedb1d69..240852d71c 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow @@ -19,19 +19,28 @@ import type { MouseEvent as $tsflower_subst$React$MouseEvent, } from 'tsflower/subst/react'; -import * as React from 'react'; -import { typeof Animated } from 'react-native'; +import { type HeaderOptions } from '@react-navigation/elements'; import { + type Descriptor, type NavigationHelpers, type NavigationProp, type ParamListBase, - type Descriptor, - type TabNavigationState, - type TabActionHelpers, type RouteProp, + type TabActionHelpers, + type TabNavigationState, } from '@react-navigation/native'; +import * as React from 'react'; +import { typeof Animated } from 'react-native'; +import { type EdgeInsets } from 'react-native-safe-area-context'; + +export type Layout = { + width: number, + height: number, + ... +}; + export type BottomTabNavigationEventMap = {| tabPress: {| data: void, @@ -48,18 +57,24 @@ export type BottomTabNavigationHelpers = NavigationHelpers< TabActionHelpers; export type BottomTabNavigationProp< ParamList: ParamListBase, - +RouteName: $Keys = string, + +RouteName: $Keys = $Keys, + NavigatorID: string | void = void, > = NavigationProp< ParamList, RouteName, + NavigatorID, TabNavigationState, BottomTabNavigationOptions, BottomTabNavigationEventMap, > & TabActionHelpers; -export type BottomTabScreenProps = string> = { - navigation: BottomTabNavigationProp, +export type BottomTabScreenProps< + ParamList: ParamListBase, + RouteName: $Keys = $Keys, + NavigatorID: string | void = void, +> = { + navigation: BottomTabNavigationProp, route: RouteProp, ... }; @@ -92,7 +107,8 @@ export type TabBarVisibilityAnimationConfig = | TimingKeyboardAnimationConfig | SpringKeyboardAnimationConfig; -export type BottomTabNavigationOptions = { +export type BottomTabNavigationOptions = {| + ...HeaderOptions, title?: string, tabBarLabel?: | string @@ -100,59 +116,56 @@ export type BottomTabNavigationOptions = { focused: boolean, color: string, position: LabelPosition, + children: string, ... }) => $tsflower_subst$React$ReactNode), + tabBarShowLabel?: boolean, + tabBarLabelPosition?: LabelPosition, + tabBarLabelStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, + tabBarAllowFontScaling?: boolean, tabBarIcon?: (props: { focused: boolean, color: string, size: number, ... }) => $tsflower_subst$React$ReactNode, + tabBarIconStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, tabBarBadge?: number | string, tabBarBadgeStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, tabBarAccessibilityLabel?: string, tabBarTestID?: string, - tabBarVisible?: boolean, + tabBarButton?: (props: BottomTabBarButtonProps) => $tsflower_subst$React$ReactNode, + tabBarActiveTintColor?: string, + tabBarInactiveTintColor?: string, + tabBarActiveBackgroundColor?: string, + tabBarInactiveBackgroundColor?: string, + tabBarItemStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + tabBarHideOnKeyboard?: boolean, tabBarVisibilityAnimationConfig?: { show?: TabBarVisibilityAnimationConfig, hide?: TabBarVisibilityAnimationConfig, ... }, - tabBarButton?: (props: BottomTabBarButtonProps) => $tsflower_subst$React$ReactNode, + tabBarStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + tabBarBackground?: () => $tsflower_subst$React$ReactNode, + lazy?: boolean, + header?: (props: BottomTabHeaderProps) => $tsflower_subst$React$ReactNode, + headerShown?: boolean, unmountOnBlur?: boolean, - ... -}; + freezeOnBlur?: boolean, +|}; export type BottomTabDescriptor = Descriptor< - ParamListBase, - string, - TabNavigationState, BottomTabNavigationOptions, + BottomTabNavigationProp, + RouteProp, >; -export type BottomTabDescriptorMap = { [key: string]: BottomTabDescriptor, ... }; - -export type BottomTabNavigationConfig = { - lazy?: boolean, - tabBar?: (props: BottomTabBarProps) => $tsflower_subst$React$ReactNode, - tabBarOptions?: T, - detachInactiveScreens?: boolean, - sceneContainerStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, - ... -}; +export type BottomTabDescriptorMap = { [key: string]: BottomTabDescriptor }; -export type BottomTabBarOptions = {| - keyboardHidesTabBar?: boolean, - activeTintColor?: string, - inactiveTintColor?: string, - activeBackgroundColor?: string, - inactiveBackgroundColor?: string, - allowFontScaling?: boolean, - showLabel?: boolean, - labelStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, - iconStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, - tabStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, - labelPosition?: LabelPosition, - adaptive?: boolean, +export type BottomTabNavigationConfig = { + tabBar?: (props: BottomTabBarProps) => $tsflower_subst$React$ReactNode, safeAreaInsets?: { top?: number, right?: number, @@ -160,15 +173,24 @@ export type BottomTabBarOptions = {| left?: number, ... }, - style?: $tsflower_subst$RN$Animated$WithAnimatedValue< - $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, - >, -|}; + detachInactiveScreens?: boolean, + sceneContainerStyle?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + ... +}; + +export type BottomTabHeaderProps = { + layout: Layout, + options: BottomTabNavigationOptions, + route: RouteProp, + navigation: BottomTabNavigationProp, + ... +}; -export type BottomTabBarProps = T & { +export type BottomTabBarProps = { state: TabNavigationState, descriptors: BottomTabDescriptorMap, navigation: NavigationHelpers, + insets: EdgeInsets, ... }; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useBottomTabBarHeight.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useBottomTabBarHeight.js.flow index e3246f6f46..44b71bd42c 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useBottomTabBarHeight.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useBottomTabBarHeight.js.flow @@ -1,4 +1,4 @@ /* @flow * @generated by TsFlower */ -declare export default function useFloatingBottomTabBarHeight(): number; +declare export default function useBottomTabBarHeight(): number; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useWindowDimensions.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useWindowDimensions.js.flow deleted file mode 100644 index 9441380aa7..0000000000 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/utils/useWindowDimensions.js.flow +++ /dev/null @@ -1,8 +0,0 @@ -/* @flow - * @generated by TsFlower - */ -declare export default function useWindowDimensions(): { - height: number, - width: number, - ... -}; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabBar.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabBar.js.flow index b8876d3924..65149ba73f 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabBar.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabBar.js.flow @@ -2,25 +2,26 @@ * @generated by TsFlower */ import type { + WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, StyleProp as $tsflower_subst$RN$StyleProp, ViewStyle as $tsflower_subst$RN$ViewStyle, - WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, } from 'tsflower/subst/react-native'; import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; +import { type ParamListBase, type TabNavigationState } from '@react-navigation/native'; import { Animated } from 'react-native'; -import { type TabNavigationState, type ParamListBase } from '@react-navigation/native'; import { type EdgeInsets } from 'react-native-safe-area-context'; -import { type BottomTabBarProps, type LabelPosition } from '../types'; - -type Props = BottomTabBarProps<> & { - activeTintColor?: string, - inactiveTintColor?: string, +import { type BottomTabBarProps, type BottomTabDescriptorMap } from '../types'; +type Props = BottomTabBarProps & { + style?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, ... }; type Options = { state: TabNavigationState, + descriptors: BottomTabDescriptorMap, layout: { height: number, width: number, @@ -31,9 +32,6 @@ type Options = { width: number, ... }, - tabStyle: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, - labelPosition: LabelPosition | void, - adaptive: boolean | void, ... }; @@ -42,7 +40,7 @@ declare export var getTabBarHeight: ( insets: EdgeInsets, style: $tsflower_subst$RN$Animated$WithAnimatedValue< $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, - >, + > | void, ... }, ) => number; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabItem.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabItem.js.flow index c27bbc9f0e..26553aaeed 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabItem.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabItem.js.flow @@ -4,6 +4,7 @@ import type { ReactNode as $tsflower_subst$React$ReactNode, MouseEvent as $tsflower_subst$React$MouseEvent, + JSXElementConstructor as $tsflower_subst$React$JSXElementConstructor, } from 'tsflower/subst/react'; import type { @@ -13,23 +14,29 @@ import type { ViewStyle as $tsflower_subst$RN$ViewStyle, } from 'tsflower/subst/react-native'; +import { type Route } from '@react-navigation/native'; import React from 'react'; import 'react-native'; -import { type Route } from '@react-navigation/native'; -import { type BottomTabBarButtonProps, type LabelPosition } from '../types'; +import { + type BottomTabBarButtonProps, + type BottomTabDescriptor, + type LabelPosition, +} from '../types'; type Props = { focused: boolean, route: Route, + descriptor: BottomTabDescriptor, label: | string | ((props: { focused: boolean, color: string, position: LabelPosition, + children: string, ... }) => $tsflower_subst$React$ReactNode), - icon?: (props: { + icon: (props: { focused: boolean, size: number, color: string, @@ -62,17 +69,5 @@ type Props = { declare export default function BottomTabBarItem( Props, -): React$Element< - | string - | (( - props: any, - ) => - | React$Element< - | string - | any - | $FlowFixMe /* new (props: any) => React.Component */ /* tsflower-unimplemented: ConstructorType */, - > - | null - | $FlowFixMe) /* new (props: any) => React.Component */ /* tsflower-unimplemented: ConstructorType */, ->; +): React$Element>; export {}; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabView.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabView.js.flow index 1d54dfea7d..126e2d15a0 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabView.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/BottomTabView.js.flow @@ -2,35 +2,20 @@ * @generated by TsFlower */ import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; -import * as React from 'react'; import { type ParamListBase, type TabNavigationState } from '@react-navigation/native'; import { - type BottomTabNavigationConfig, type BottomTabDescriptorMap, + type BottomTabNavigationConfig, type BottomTabNavigationHelpers, } from '../types'; -type Props = BottomTabNavigationConfig<> & { +type Props = BottomTabNavigationConfig & { state: TabNavigationState, navigation: BottomTabNavigationHelpers, descriptors: BottomTabDescriptorMap, ... }; -type State = { - loaded: string[], - tabBarHeight: number, - ... -}; - -declare export default class BottomTabView extends React.Component { - defaultProps: { lazy: boolean, ... }; - getDerivedStateFromProps(nextProps: Props, prevState: State): { loaded: any[], ... }; - constructor(props: Props): any; - renderTabBar: any; - handleTabBarHeightChange: any; - render(): $tsflower_subst$React$JSX$Element; -} - +declare export default function BottomTabView(props: Props): $tsflower_subst$React$JSX$Element; export {}; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/SafeAreaProviderCompat.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/SafeAreaProviderCompat.js.flow deleted file mode 100644 index d602257796..0000000000 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/SafeAreaProviderCompat.js.flow +++ /dev/null @@ -1,29 +0,0 @@ -/* @flow - * @generated by TsFlower - */ -import type { - ReactNode as $tsflower_subst$React$ReactNode, - JSX$Element as $tsflower_subst$React$JSX$Element, -} from 'tsflower/subst/react'; - -import * as React from 'react'; - -declare export var initialSafeAreaInsets: - | { - top: number, - bottom: number, - right: number, - left: number, - ... - } - | { - top: number, - right: number, - bottom: number, - left: number, - ... - }; - -type Props = { children: $tsflower_subst$React$ReactNode, ... }; -declare export default function SafeAreaProviderCompat(Props): $tsflower_subst$React$JSX$Element; -export {}; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/ScreenFallback.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/ScreenFallback.js.flow new file mode 100644 index 0000000000..9cb3685402 --- /dev/null +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/ScreenFallback.js.flow @@ -0,0 +1,37 @@ +/* @flow + * @generated by TsFlower + */ +import type { + ReactNode as $tsflower_subst$React$ReactNode, + JSX$Element as $tsflower_subst$React$JSX$Element, +} from 'tsflower/subst/react'; + +import type { + StyleProp as $tsflower_subst$RN$StyleProp, + ViewStyle as $tsflower_subst$RN$ViewStyle, + ViewProps as $tsflower_subst$RN$ViewProps, +} from 'tsflower/subst/react-native'; + +import * as React from 'react'; +import 'react-native'; + +type Props = { + visible: boolean, + children: $tsflower_subst$React$ReactNode, + enabled: boolean, + freezeOnBlur?: boolean, + style?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + ... +}; + +declare export var MaybeScreenContainer: ( + $tsflower_subst$RN$ViewProps & { + enabled: boolean, + hasTwoStates: boolean, + children: $tsflower_subst$React$ReactNode, + ... + }, +) => $tsflower_subst$React$JSX$Element; + +declare export function MaybeScreen(Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/TabBarIcon.js.flow b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/TabBarIcon.js.flow index ca0ec55485..4095a54a4e 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/TabBarIcon.js.flow +++ b/types/@react-navigation/bottom-tabs/lib/typescript/src/views/TabBarIcon.js.flow @@ -12,9 +12,9 @@ import type { JSX$Element as $tsflower_subst$React$JSX$Element, } from 'tsflower/subst/react'; +import { type Route } from '@react-navigation/native'; import React from 'react'; import 'react-native'; -import { type Route } from '@react-navigation/native'; type Props = { route: Route, diff --git a/types/@react-navigation/elements/index.js.flow b/types/@react-navigation/elements/index.js.flow new file mode 100644 index 0000000000..8af8d9b993 --- /dev/null +++ b/types/@react-navigation/elements/index.js.flow @@ -0,0 +1,4 @@ +/* @flow + * @generated + */ +export * from './lib/typescript/src/index.js.flow'; diff --git a/types/@react-navigation/elements/lib/typescript/src/Background.js.flow b/types/@react-navigation/elements/lib/typescript/src/Background.js.flow new file mode 100644 index 0000000000..9ebcebc303 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Background.js.flow @@ -0,0 +1,15 @@ +/* @flow + * @generated by TsFlower + */ +import type { ViewProps as $tsflower_subst$RN$ViewProps } from 'tsflower/subst/react-native'; + +import type { + ReactNode as $tsflower_subst$React$ReactNode, + JSX$Element as $tsflower_subst$React$JSX$Element, +} from 'tsflower/subst/react'; + +import * as React from 'react'; +import 'react-native'; +type Props = $tsflower_subst$RN$ViewProps & { children: $tsflower_subst$React$ReactNode, ... }; +declare export default function Background(Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/Header.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/Header.js.flow new file mode 100644 index 0000000000..447793e302 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/Header.js.flow @@ -0,0 +1,15 @@ +/* @flow + * @generated by TsFlower + */ +import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; +import { type HeaderOptions, type Layout } from '../types'; + +type Props = HeaderOptions & { + modal?: boolean, + layout?: Layout, + title: string, + ... +}; + +declare export default function Header(props: Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackButton.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackButton.js.flow new file mode 100644 index 0000000000..edb06b37c1 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackButton.js.flow @@ -0,0 +1,8 @@ +/* @flow + * @generated by TsFlower + */ +import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; +import { type HeaderBackButtonProps } from '../types'; +declare export default function HeaderBackButton( + HeaderBackButtonProps, +): $tsflower_subst$React$JSX$Element; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackContext.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackContext.js.flow new file mode 100644 index 0000000000..652ca2f8d9 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackContext.js.flow @@ -0,0 +1,6 @@ +/* @flow + * @generated by TsFlower + */ +import type { Context as $tsflower_import_type$_$react$Context } from 'react'; +declare var HeaderBackContext: $tsflower_import_type$_$react$Context<{ title: string, ... } | void>; +export default HeaderBackContext; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackground.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackground.js.flow new file mode 100644 index 0000000000..b65f693555 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderBackground.js.flow @@ -0,0 +1,28 @@ +/* @flow + * @generated by TsFlower + */ +import type { + ViewProps as $tsflower_subst$RN$ViewProps, + WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, + StyleProp as $tsflower_subst$RN$StyleProp, + ViewStyle as $tsflower_subst$RN$ViewStyle, +} from 'tsflower/subst/react-native'; + +import type { + ReactNode as $tsflower_subst$React$ReactNode, + JSX$Element as $tsflower_subst$React$JSX$Element, +} from 'tsflower/subst/react'; + +import * as React from 'react'; +import { Animated } from 'react-native'; + +type Props = $Diff<$tsflower_subst$RN$ViewProps, {| style: mixed |}> & { + style?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + children?: $tsflower_subst$React$ReactNode, + ... +}; + +declare export default function HeaderBackground(Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/HeaderHeightContext.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderHeightContext.js.flow new file mode 100644 index 0000000000..0a539dfd16 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderHeightContext.js.flow @@ -0,0 +1,6 @@ +/* @flow + * @generated by TsFlower + */ +import type { Context as $tsflower_import_type$_$react$Context } from 'react'; +declare var HeaderHeightContext: $tsflower_import_type$_$react$Context; +export default HeaderHeightContext; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/HeaderShownContext.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderShownContext.js.flow new file mode 100644 index 0000000000..861514a266 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderShownContext.js.flow @@ -0,0 +1,6 @@ +/* @flow + * @generated by TsFlower + */ +import type { Context as $tsflower_import_type$_$react$Context } from 'react'; +declare var HeaderShownContext: $tsflower_import_type$_$react$Context; +export default HeaderShownContext; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/HeaderTitle.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderTitle.js.flow new file mode 100644 index 0000000000..94559721b1 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/HeaderTitle.js.flow @@ -0,0 +1,23 @@ +/* @flow + * @generated by TsFlower + */ +import type { + TextProps as $tsflower_subst$RN$TextProps, + WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, + StyleProp as $tsflower_subst$RN$StyleProp, + TextStyle as $tsflower_subst$RN$TextStyle, +} from 'tsflower/subst/react-native'; + +import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; +import { Animated } from 'react-native'; + +type Props = $Diff<$tsflower_subst$RN$TextProps, {| style: mixed |}> & { + tintColor?: string, + style?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, + >, + ... +}; + +declare export default function HeaderTitle(Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/getDefaultHeaderHeight.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/getDefaultHeaderHeight.js.flow new file mode 100644 index 0000000000..a6e04f6539 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/getDefaultHeaderHeight.js.flow @@ -0,0 +1,9 @@ +/* @flow + * @generated by TsFlower + */ +import { type Layout } from '../types'; +declare export default function getDefaultHeaderHeight( + layout: Layout, + modalPresentation: boolean, + statusBarHeight: number, +): number; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/getHeaderTitle.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/getHeaderTitle.js.flow new file mode 100644 index 0000000000..8ff99e031d --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/getHeaderTitle.js.flow @@ -0,0 +1,13 @@ +/* @flow + * @generated by TsFlower + */ +import { type HeaderOptions } from '../types'; + +declare export default function getHeaderTitle( + options: { + title?: string, + headerTitle?: $ElementType, + ... + }, + fallback: string, +): string; diff --git a/types/@react-navigation/elements/lib/typescript/src/Header/useHeaderHeight.js.flow b/types/@react-navigation/elements/lib/typescript/src/Header/useHeaderHeight.js.flow new file mode 100644 index 0000000000..fd97c706c1 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Header/useHeaderHeight.js.flow @@ -0,0 +1,4 @@ +/* @flow + * @generated by TsFlower + */ +declare export default function useHeaderHeight(): number; diff --git a/types/@react-navigation/elements/lib/typescript/src/MaskedView.android.js.flow b/types/@react-navigation/elements/lib/typescript/src/MaskedView.android.js.flow new file mode 100644 index 0000000000..37ab18994e --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/MaskedView.android.js.flow @@ -0,0 +1,4 @@ +/* @flow + * @generated by TsFlower + */ +export { default } from './MaskedViewNative'; diff --git a/types/@react-navigation/elements/lib/typescript/src/MaskedView.ios.js.flow b/types/@react-navigation/elements/lib/typescript/src/MaskedView.ios.js.flow new file mode 100644 index 0000000000..37ab18994e --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/MaskedView.ios.js.flow @@ -0,0 +1,4 @@ +/* @flow + * @generated by TsFlower + */ +export { default } from './MaskedViewNative'; diff --git a/types/@react-navigation/elements/lib/typescript/src/MaskedView.js.flow b/types/@react-navigation/elements/lib/typescript/src/MaskedView.js.flow new file mode 100644 index 0000000000..45d000a198 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/MaskedView.js.flow @@ -0,0 +1,16 @@ +/* @flow + * @generated by TsFlower + */ +import type { JSXElementConstructor as $tsflower_subst$React$JSXElementConstructor } from 'tsflower/subst/react'; +import * as React from 'react'; + +type Props = { + maskElement: React$Element, + children: React$Element, + ... +}; + +declare export default function MaskedView( + Props, +): React$Element>; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow b/types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow new file mode 100644 index 0000000000..cc5fc23066 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow @@ -0,0 +1,15 @@ +/* @flow + * @generated by TsFlower + */ +import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; +import type { ViewProps as $tsflower_subst$RN$ViewProps } from 'tsflower/subst/react-native'; + +type Props = { + ...$tsflower_subst$RN$ViewProps, + maskElement: React$Element, + androidRenderingMode?: 'software' | 'hardware', + children: React$Element, + ... +}; +declare export default function MaskedView(Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/MissingIcon.js.flow b/types/@react-navigation/elements/lib/typescript/src/MissingIcon.js.flow new file mode 100644 index 0000000000..cc4d8ad433 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/MissingIcon.js.flow @@ -0,0 +1,20 @@ +/* @flow + * @generated by TsFlower + */ +import type { + StyleProp as $tsflower_subst$RN$StyleProp, + TextStyle as $tsflower_subst$RN$TextStyle, +} from 'tsflower/subst/react-native'; + +import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; +import 'react-native'; + +type Props = { + color?: string, + size?: number, + style?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, + ... +}; + +declare export default function MissingIcon(Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/PlatformPressable.js.flow b/types/@react-navigation/elements/lib/typescript/src/PlatformPressable.js.flow new file mode 100644 index 0000000000..ccb1f6d7be --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/PlatformPressable.js.flow @@ -0,0 +1,29 @@ +/* @flow + * @generated by TsFlower + */ +import type { + PressableProps as $tsflower_subst$RN$PressableProps, + WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, + StyleProp as $tsflower_subst$RN$StyleProp, + ViewStyle as $tsflower_subst$RN$ViewStyle, +} from 'tsflower/subst/react-native'; + +import type { + ReactNode as $tsflower_subst$React$ReactNode, + JSX$Element as $tsflower_subst$React$JSX$Element, +} from 'tsflower/subst/react'; + +import * as React from 'react'; +import { Animated } from 'react-native'; + +export type Props = $Diff<$tsflower_subst$RN$PressableProps, {| style: mixed |}> & { + pressColor?: string, + pressOpacity?: number, + style?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + children: $tsflower_subst$React$ReactNode, + ... +}; + +declare export default function PlatformPressable(Props): $tsflower_subst$React$JSX$Element; diff --git a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/ResourceSavingScene.js.flow b/types/@react-navigation/elements/lib/typescript/src/ResourceSavingView.js.flow similarity index 60% rename from types/@react-navigation/bottom-tabs/lib/typescript/src/views/ResourceSavingScene.js.flow rename to types/@react-navigation/elements/lib/typescript/src/ResourceSavingView.js.flow index e3792c55e8..34c0bebd25 100644 --- a/types/@react-navigation/bottom-tabs/lib/typescript/src/views/ResourceSavingScene.js.flow +++ b/types/@react-navigation/elements/lib/typescript/src/ResourceSavingView.js.flow @@ -6,13 +6,18 @@ import type { JSX$Element as $tsflower_subst$React$JSX$Element, } from 'tsflower/subst/react'; +import type { + StyleProp as $tsflower_subst$RN$StyleProp, + ViewStyle as $tsflower_subst$RN$ViewStyle, +} from 'tsflower/subst/react-native'; + import * as React from 'react'; +import 'react-native'; type Props = { - isVisible: boolean, + visible: boolean, children: $tsflower_subst$React$ReactNode, - enabled: boolean, - style?: any, + style?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, ... }; diff --git a/types/@react-navigation/elements/lib/typescript/src/SafeAreaProviderCompat.js.flow b/types/@react-navigation/elements/lib/typescript/src/SafeAreaProviderCompat.js.flow new file mode 100644 index 0000000000..6cfa11265e --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/SafeAreaProviderCompat.js.flow @@ -0,0 +1,32 @@ +/* @flow + * @generated by TsFlower + */ +import type { + ReactNode as $tsflower_subst$React$ReactNode, + JSX$Element as $tsflower_subst$React$JSX$Element, +} from 'tsflower/subst/react'; + +import type { + StyleProp as $tsflower_subst$RN$StyleProp, + ViewStyle as $tsflower_subst$RN$ViewStyle, +} from 'tsflower/subst/react-native'; + +import * as React from 'react'; +import 'react-native'; +import { type Metrics } from 'react-native-safe-area-context'; + +type Props = { + children: $tsflower_subst$React$ReactNode, + style?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + ... +}; + +declare function SafeAreaProviderCompat(Props): $tsflower_subst$React$JSX$Element; + +/* tsflower-unimplemented: ModuleDeclaration */ +/* +declare namespace SafeAreaProviderCompat { + var initialMetrics: Metrics; +} */ + +export default SafeAreaProviderCompat; diff --git a/types/@react-navigation/elements/lib/typescript/src/Screen.js.flow b/types/@react-navigation/elements/lib/typescript/src/Screen.js.flow new file mode 100644 index 0000000000..e3163ec456 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/Screen.js.flow @@ -0,0 +1,33 @@ +/* @flow + * @generated by TsFlower + */ +import type { + ReactNode as $tsflower_subst$React$ReactNode, + JSX$Element as $tsflower_subst$React$JSX$Element, +} from 'tsflower/subst/react'; + +import type { + StyleProp as $tsflower_subst$RN$StyleProp, + ViewStyle as $tsflower_subst$RN$ViewStyle, +} from 'tsflower/subst/react-native'; + +import { type NavigationProp, type ParamListBase, type RouteProp } from '@react-navigation/native'; +import * as React from 'react'; +import 'react-native'; + +type Props = { + focused: boolean, + modal?: boolean, + navigation: NavigationProp, + route: RouteProp, + header: $tsflower_subst$React$ReactNode, + headerShown?: boolean, + headerStatusBarHeight?: number, + headerTransparent?: boolean, + style?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + children: $tsflower_subst$React$ReactNode, + ... +}; + +declare export default function Screen(props: Props): $tsflower_subst$React$JSX$Element; +export {}; diff --git a/types/@react-navigation/elements/lib/typescript/src/getNamedContext.js.flow b/types/@react-navigation/elements/lib/typescript/src/getNamedContext.js.flow new file mode 100644 index 0000000000..bf6bb8fb5d --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/getNamedContext.js.flow @@ -0,0 +1,16 @@ +/* @flow + * @generated by TsFlower + */ +import type { Context as $tsflower_subst$React$Context } from 'tsflower/subst/react'; +import * as React from 'react'; + +/* tsflower-unimplemented: ModuleDeclaration */ +/* +declare global { + var __react_navigation__elements_contexts: Map>; +} */ + +declare export default function getNamedContext( + name: string, + initialValue: T, +): $tsflower_subst$React$Context; diff --git a/types/@react-navigation/elements/lib/typescript/src/index.js.flow b/types/@react-navigation/elements/lib/typescript/src/index.js.flow new file mode 100644 index 0000000000..dc4cf50381 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/index.js.flow @@ -0,0 +1,21 @@ +/* @flow + * @generated by TsFlower + */ +export { default as Background } from './Background'; +export { default as getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight'; +export { default as getHeaderTitle } from './Header/getHeaderTitle'; +export { default as Header } from './Header/Header'; +export { default as HeaderBackButton } from './Header/HeaderBackButton'; +export { default as HeaderBackContext } from './Header/HeaderBackContext'; +export { default as HeaderBackground } from './Header/HeaderBackground'; +export { default as HeaderHeightContext } from './Header/HeaderHeightContext'; +export { default as HeaderShownContext } from './Header/HeaderShownContext'; +export { default as HeaderTitle } from './Header/HeaderTitle'; +export { default as useHeaderHeight } from './Header/useHeaderHeight'; +export { default as MissingIcon } from './MissingIcon'; +export { default as PlatformPressable } from './PlatformPressable'; +export { default as ResourceSavingView } from './ResourceSavingView'; +export { default as SafeAreaProviderCompat } from './SafeAreaProviderCompat'; +export { default as Screen } from './Screen'; +declare export var Assets: any[]; +export * from './types'; diff --git a/types/@react-navigation/elements/lib/typescript/src/types.js.flow b/types/@react-navigation/elements/lib/typescript/src/types.js.flow new file mode 100644 index 0000000000..30869a9929 --- /dev/null +++ b/types/@react-navigation/elements/lib/typescript/src/types.js.flow @@ -0,0 +1,109 @@ +/* @flow + * @generated by TsFlower + */ + +import type { ReactNode as $tsflower_subst$React$ReactNode } from 'tsflower/subst/react'; +import type { + WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, + StyleProp as $tsflower_subst$RN$StyleProp, + TextStyle as $tsflower_subst$RN$TextStyle, + ViewStyle as $tsflower_subst$RN$ViewStyle, + LayoutChangeEvent as $tsflower_subst$RN$LayoutChangeEvent, +} from 'tsflower/subst/react-native'; + +import { typeof Animated } from 'react-native'; + +export type Layout = { + width: number, + height: number, + ... +}; + +export type HeaderOptions = {| + headerTitle?: string | ((props: HeaderTitleProps) => $tsflower_subst$React$ReactNode), + headerTitleAlign?: 'left' | 'center', + headerTitleStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, + >, + headerTitleContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerTitleAllowFontScaling?: boolean, + headerLeft?: (props: { + tintColor?: string, + pressColor?: string, + pressOpacity?: number, + labelVisible?: boolean, + ... + }) => $tsflower_subst$React$ReactNode, + headerLeftLabelVisible?: boolean, + headerLeftContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerRight?: (props: { + tintColor?: string, + pressColor?: string, + pressOpacity?: number, + ... + }) => $tsflower_subst$React$ReactNode, + headerRightContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerPressColor?: string, + headerPressOpacity?: number, + headerTintColor?: string, + headerBackground?: (props: { + style: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + ... + }) => $tsflower_subst$React$ReactNode, + headerBackgroundContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerTransparent?: boolean, + headerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerShadowVisible?: boolean, + headerStatusBarHeight?: number, +|}; + +export type HeaderTitleProps = { + children: string, + allowFontScaling?: boolean, + tintColor?: string, + onLayout?: (e: $tsflower_subst$RN$LayoutChangeEvent) => void, + style?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, + >, + ... +}; + +export type HeaderButtonProps = { + tintColor?: string, + pressColor?: string, + pressOpacity?: number, + canGoBack?: boolean, + ... +}; + +export type HeaderBackButtonProps = HeaderButtonProps & { + disabled?: boolean, + onPress?: () => void, + backImage?: (props: { tintColor: string, ... }) => $tsflower_subst$React$ReactNode, + label?: string, + truncatedLabel?: string, + labelVisible?: boolean, + labelStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, + >, + allowFontScaling?: boolean, + onLabelLayout?: (e: $tsflower_subst$RN$LayoutChangeEvent) => void, + screenLayout?: Layout, + titleLayout?: Layout, + accessibilityLabel?: string, + testID?: string, + style?: $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + ... +}; diff --git a/types/patches/0011-upstream-rnav-On-create-Navigator-cut-redundant-wron.patch b/types/patches/0011-upstream-rnav-On-create-Navigator-cut-redundant-wron.patch index aaafca28c3..a199c32c07 100644 --- a/types/patches/0011-upstream-rnav-On-create-Navigator-cut-redundant-wron.patch +++ b/types/patches/0011-upstream-rnav-On-create-Navigator-cut-redundant-wron.patch @@ -16,10 +16,31 @@ to TypedNavigator on the line after that.) And TypedNavigator actually passes the ParamList type when it does so, so it has a chance of being right. --- + .../src/navigators/createBottomTabNavigator.js.flow | 9 +-------- .../src/navigators/createMaterialTopTabNavigator.js.flow | 9 +-------- .../src/navigators/createStackNavigator.js.flow | 6 +++--- - 2 files changed, 4 insertions(+), 11 deletions(-) + 3 files changed, 5 insertions(+), 19 deletions(-) +diff --git types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow +index 7e16fb708..ebf13d3dc 100644 +--- types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow ++++ types/@react-navigation/bottom-tabs/lib/typescript/src/navigators/createBottomTabNavigator.js.flow +@@ -17,14 +17,7 @@ import { + type BottomTabNavigationOptions, + } from '../types'; + +-type Props = DefaultNavigatorOptions< +- ParamListBase, +- TabNavigationState, +- BottomTabNavigationOptions, +- BottomTabNavigationEventMap, +-> & +- TabRouterOptions & +- BottomTabNavigationConfig; ++type Props = TabRouterOptions & BottomTabNavigationConfig; + declare function BottomTabNavigator(Props): $tsflower_subst$React$JSX$Element; + declare var _default: < + ParamList: ParamListBase, diff --git types/@react-navigation/material-top-tabs/lib/typescript/src/navigators/createMaterialTopTabNavigator.js.flow types/@react-navigation/material-top-tabs/lib/typescript/src/navigators/createMaterialTopTabNavigator.js.flow index bc11a7c76..f0a91a5ad 100644 --- types/@react-navigation/material-top-tabs/lib/typescript/src/navigators/createMaterialTopTabNavigator.js.flow diff --git a/types/patches/0014-irreducible-rnav-Covariant-type-parameters-on-variou.patch b/types/patches/0014-irreducible-rnav-Covariant-type-parameters-on-variou.patch index 182c670d51..81f175ba5b 100644 --- a/types/patches/0014-irreducible-rnav-Covariant-type-parameters-on-variou.patch +++ b/types/patches/0014-irreducible-rnav-Covariant-type-parameters-on-variou.patch @@ -14,18 +14,18 @@ NavigationHelpersCommon, NavigationState, PartialState. 5 files changed, 12 insertions(+), 12 deletions(-) diff --git types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow -index d3c2017d4..3bc615faa 100644 +index 8908b03c2..ff27c12ba 100644 --- types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow +++ types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow -@@ -50,7 +50,7 @@ export type BottomTabNavigationHelpers = NavigationHelpers< +@@ -59,7 +59,7 @@ export type BottomTabNavigationHelpers = NavigationHelpers< TabActionHelpers; export type BottomTabNavigationProp< ParamList: ParamListBase, -- RouteName: $Keys = string, -+ +RouteName: $Keys = string, +- RouteName: $Keys = $Keys, ++ +RouteName: $Keys = $Keys, + NavigatorID: string | void = void, > = NavigationProp< ParamList, - RouteName, diff --git types/@react-navigation/core/lib/typescript/src/types.js.flow types/@react-navigation/core/lib/typescript/src/types.js.flow index 41f13ea18..ccdd92d43 100644 --- types/@react-navigation/core/lib/typescript/src/types.js.flow diff --git a/types/patches/0015-irreducible-rnav-EventMap-types-exact-and-covariant.patch b/types/patches/0015-irreducible-rnav-EventMap-types-exact-and-covariant.patch index 356826e743..e3822776c1 100644 --- a/types/patches/0015-irreducible-rnav-EventMap-types-exact-and-covariant.patch +++ b/types/patches/0015-irreducible-rnav-EventMap-types-exact-and-covariant.patch @@ -14,12 +14,12 @@ subtypes of the latter's. 4 files changed, 37 insertions(+), 47 deletions(-) diff --git types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow -index 3bc615faa..ed9343057 100644 +index ff27c12ba..93f9f4c0d 100644 --- types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow +++ types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow -@@ -32,15 +32,13 @@ import { - type RouteProp, - } from '@react-navigation/native'; +@@ -41,15 +41,13 @@ export type Layout = { + ... + }; -export type BottomTabNavigationEventMap = { - tabPress: { diff --git a/types/patches/0055-irreducible-rnav-Make-top-and-bottom-tab-bar-options.patch b/types/patches/0055-irreducible-rnav-Make-top-and-bottom-tab-bar-options.patch index 40b012b8be..65a63664c9 100644 --- a/types/patches/0055-irreducible-rnav-Make-top-and-bottom-tab-bar-options.patch +++ b/types/patches/0055-irreducible-rnav-Make-top-and-bottom-tab-bar-options.patch @@ -5,33 +5,58 @@ Subject: [irreducible] rnav: Make top and bottom tab-bar options exact Maybe someday TypeScript will have exact object types. --- - .../bottom-tabs/lib/typescript/src/types.js.flow | 5 ++--- - .../material-top-tabs/lib/typescript/src/types.js.flow | 5 ++--- - 2 files changed, 4 insertions(+), 6 deletions(-) + .../bottom-tabs/lib/typescript/src/types.js.flow | 6 +++--- + .../elements/lib/typescript/src/types.js.flow | 5 ++--- + .../material-top-tabs/lib/typescript/src/types.js.flow | 5 ++--- + 3 files changed, 7 insertions(+), 9 deletions(-) diff --git types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow -index ed9343057..03dedb1d6 100644 +index 93f9f4c0d..240852d71 100644 --- types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow +++ types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow -@@ -140,7 +140,7 @@ export type BottomTabNavigationConfig = { +@@ -107,7 +107,8 @@ export type TabBarVisibilityAnimationConfig = + | TimingKeyboardAnimationConfig + | SpringKeyboardAnimationConfig; + +-export type BottomTabNavigationOptions = HeaderOptions & { ++export type BottomTabNavigationOptions = {| ++ ...HeaderOptions, + title?: string, + tabBarLabel?: + | string +@@ -154,8 +155,7 @@ export type BottomTabNavigationOptions = HeaderOptions & { + headerShown?: boolean, + unmountOnBlur?: boolean, + freezeOnBlur?: boolean, +- ... +-}; ++|}; + + export type BottomTabDescriptor = Descriptor< + BottomTabNavigationOptions, +diff --git types/@react-navigation/elements/lib/typescript/src/types.js.flow types/@react-navigation/elements/lib/typescript/src/types.js.flow +index 1270d287b..8fdc33df0 100644 +--- types/@react-navigation/elements/lib/typescript/src/types.js.flow ++++ types/@react-navigation/elements/lib/typescript/src/types.js.flow +@@ -17,7 +17,7 @@ export type Layout = { ... }; --export type BottomTabBarOptions = { -+export type BottomTabBarOptions = {| - keyboardHidesTabBar?: boolean, - activeTintColor?: string, - inactiveTintColor?: string, -@@ -163,8 +163,7 @@ export type BottomTabBarOptions = { - style?: $tsflower_subst$RN$Animated$WithAnimatedValue< - $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, +-export type HeaderOptions = { ++export type HeaderOptions = {| + headerTitle?: string | ((props: HeaderTitleProps) => React.ReactNode), + headerTitleAlign?: 'left' | 'center', + headerTitleStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< +@@ -65,8 +65,7 @@ export type HeaderOptions = { >, + headerShadowVisible?: boolean, + headerStatusBarHeight?: number, - ... -}; +|}; - export type BottomTabBarProps = T & { - state: TabNavigationState, + export type HeaderTitleProps = { + children: string, diff --git types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow index 6e3b1b9e4..7abe20b5f 100644 --- types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow diff --git a/types/patches/0056-tsflower-rnav-Handle-an-instance-of-reference-types-.patch b/types/patches/0056-tsflower-rnav-Handle-an-instance-of-reference-types-.patch new file mode 100644 index 0000000000..ba28bf8f65 --- /dev/null +++ b/types/patches/0056-tsflower-rnav-Handle-an-instance-of-reference-types-.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Bobbe +Date: Thu, 11 Apr 2024 15:54:50 -0700 +Subject: [tsflower] rnav: Handle an instance of /// + +This is in the TsFlower TODO: + https://github.com/gnprice/tsflower?tab=readme-ov-file#todo +--- + .../elements/lib/typescript/src/types.js.flow | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git types/@react-navigation/elements/lib/typescript/src/types.js.flow types/@react-navigation/elements/lib/typescript/src/types.js.flow +index 8fdc33df0..30869a992 100644 +--- types/@react-navigation/elements/lib/typescript/src/types.js.flow ++++ types/@react-navigation/elements/lib/typescript/src/types.js.flow +@@ -1,6 +1,8 @@ + /* @flow + * @generated by TsFlower + */ ++ ++import type { ReactNode as $tsflower_subst$React$ReactNode } from 'tsflower/subst/react'; + import type { + WithAnimatedValue as $tsflower_subst$RN$Animated$WithAnimatedValue, + StyleProp as $tsflower_subst$RN$StyleProp, +@@ -18,7 +20,7 @@ export type Layout = { + }; + + export type HeaderOptions = {| +- headerTitle?: string | ((props: HeaderTitleProps) => React.ReactNode), ++ headerTitle?: string | ((props: HeaderTitleProps) => $tsflower_subst$React$ReactNode), + headerTitleAlign?: 'left' | 'center', + headerTitleStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$TextStyle>, +@@ -33,29 +35,29 @@ export type HeaderOptions = {| + pressOpacity?: number, + labelVisible?: boolean, + ... +- }) => React.ReactNode, ++ }) => $tsflower_subst$React$ReactNode, + headerLeftLabelVisible?: boolean, + headerLeftContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerRight?: (props: { + tintColor?: string, + pressColor?: string, + pressOpacity?: number, + ... +- }) => React.ReactNode, ++ }) => $tsflower_subst$React$ReactNode, + headerRightContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + headerPressColor?: string, + headerPressOpacity?: number, + headerTintColor?: string, + headerBackground?: (props: { + style: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, + ... +- }) => React.ReactNode, ++ }) => $tsflower_subst$React$ReactNode, + headerBackgroundContainerStyle?: $tsflower_subst$RN$Animated$WithAnimatedValue< + $tsflower_subst$RN$StyleProp<$tsflower_subst$RN$ViewStyle>, + >, +@@ -89,7 +91,7 @@ export type HeaderButtonProps = { + export type HeaderBackButtonProps = HeaderButtonProps & { + disabled?: boolean, + onPress?: () => void, +- backImage?: (props: { tintColor: string, ... }) => React.ReactNode, ++ backImage?: (props: { tintColor: string, ... }) => $tsflower_subst$React$ReactNode, + label?: string, + truncatedLabel?: string, + labelVisible?: boolean, +-- +2.32.0 + diff --git a/types/patches/0057-shortcut-rnav-Copy-paste-translated-Props-type-rathe.patch b/types/patches/0057-shortcut-rnav-Copy-paste-translated-Props-type-rathe.patch new file mode 100644 index 0000000000..e3683fbf97 --- /dev/null +++ b/types/patches/0057-shortcut-rnav-Copy-paste-translated-Props-type-rathe.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Bobbe +Date: Thu, 11 Apr 2024 16:22:37 -0700 +Subject: [shortcut] rnav: Copy-paste translated Props type rather than + importing + +I don't really know what this @react-native-masked-view/masked-view +stuff is about. This @react-navigation/elements package lists it as +a *dev* dependency and calls it "optional": + https://github.com/react-navigation/react-navigation/blob/6.x/packages/elements/src/MaskedViewNative.tsx#L17 + +Anyway, the type we want from it is simple, so we just translate it +and copy-paste it here, instead of adding the dependency and giving +more work to tools/tsflower. +--- + .../typescript/src/MaskedViewNative.js.flow | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +diff --git types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow +index 39da71d49..cc5fc2306 100644 +--- types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow ++++ types/@react-navigation/elements/lib/typescript/src/MaskedViewNative.js.flow +@@ -1,19 +1,13 @@ + /* @flow + * @generated by TsFlower + */ +-import typeof * as $tsflower_import_typeof$_$_40_react_2d_native_2d_masked_2d_view_2f_masked_2d_view from '@react-native-masked-view/masked-view'; ++import type { JSX$Element as $tsflower_subst$React$JSX$Element } from 'tsflower/subst/react'; ++import type { ViewProps as $tsflower_subst$RN$ViewProps } from 'tsflower/subst/react-native'; + +-import type { +- ComponentProps as $tsflower_subst$React$ComponentProps, +- JSX$Element as $tsflower_subst$React$JSX$Element, +-} from 'tsflower/subst/react'; +- +-import * as React from 'react'; +-type MaskedViewType = $ElementType< +- $tsflower_import_typeof$_$_40_react_2d_native_2d_masked_2d_view_2f_masked_2d_view, +- 'default', +->; +-type Props = $tsflower_subst$React$ComponentProps & { ++type Props = { ++ ...$tsflower_subst$RN$ViewProps, ++ maskElement: React$Element, ++ androidRenderingMode?: 'software' | 'hardware', + children: React$Element, + ... + }; +-- +2.32.0 + diff --git a/yarn.lock b/yarn.lock index 687704efad..3a037b694e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2359,13 +2359,14 @@ resolved "https://registry.yarnpkg.com/@react-native/polyfills/-/polyfills-2.0.0.tgz#4c40b74655c83982c8cf47530ee7dc13d957b6aa" integrity sha512-K0aGNn1TjalKj+65D7ycc1//H9roAQ51GJVk5ZJQFb2teECGmzd86bYDC0aYdbRf7gtovescq4Zt6FR0tgXiHQ== -"@react-navigation/bottom-tabs@npm:@zulip/react-navigation-bottom-tabs@5.11.16-0.zulip.1": - version "5.11.16-0.zulip.1" - resolved "https://registry.yarnpkg.com/@zulip/react-navigation-bottom-tabs/-/react-navigation-bottom-tabs-5.11.16-0.zulip.1.tgz#658fe0e4c468f5ede0f4bb6f7412415397d9f94d" - integrity sha512-C0fWmWfDMda+q06WQWtEL3x9fib0KvOOGBOxPDPfzCKlLiiVeMUGwWKaoAsEPm/d+w7Ktg3kgs9LdgM1ugWlmg== +"@react-navigation/bottom-tabs@^6.5.20": + version "6.5.20" + resolved "https://registry.yarnpkg.com/@react-navigation/bottom-tabs/-/bottom-tabs-6.5.20.tgz#5335e75b02c527ef0569bd97d4f9185d65616e49" + integrity sha512-ow6Z06iS4VqBO8d7FP+HsGjJLWt2xTWIvuWjpoCvsM/uQXzCRDIjBv9HaKcXbF0yTW7IMir0oDAbU5PFzEDdgA== dependencies: - color "^3.1.3" - react-native-iphone-x-helper "^1.3.0" + "@react-navigation/elements" "^1.3.30" + color "^4.2.3" + warn-once "^0.1.0" "@react-navigation/core@^5.16.1": version "5.16.1" @@ -2378,6 +2379,11 @@ query-string "^6.13.6" react-is "^16.13.0" +"@react-navigation/elements@^1.3.30": + version "1.3.30" + resolved "https://registry.yarnpkg.com/@react-navigation/elements/-/elements-1.3.30.tgz#a81371f599af1070b12014f05d6c09b1a611fd9a" + integrity sha512-plhc8UvCZs0UkV+sI+3bisIyn78wz9O/BiWZXpounu72k/R/Sj5PuZYFJ1fi6psvriUveMCGh4LeZckAZu2qiQ== + "@react-navigation/material-top-tabs@^6.6.13": version "6.6.13" resolved "https://registry.yarnpkg.com/@react-navigation/material-top-tabs/-/material-top-tabs-6.6.13.tgz#d32a787d61ae7115797672cbaf477df149b7deba"