Changeset View
Changeset View
Standalone View
Standalone View
native/chat/sidebar-navigation.js
// @flow | // @flow | ||||
import invariant from 'invariant'; | import invariant from 'invariant'; | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { createPendingSidebar } from 'lib/shared/thread-utils'; | import { createPendingSidebar } from 'lib/shared/thread-utils'; | ||||
import type { ThreadInfo } from 'lib/types/thread-types'; | import type { ThreadInfo } from 'lib/types/thread-types'; | ||||
import type { DispatchFunctions, ActionFunc } from 'lib/utils/action-utils'; | import type { DispatchFunctions, BindServerCall } from 'lib/utils/action-utils'; | ||||
import type { InputState } from '../input/input-state'; | import type { InputState } from '../input/input-state'; | ||||
import { getDefaultTextMessageRules } from '../markdown/rules.react'; | import { getDefaultTextMessageRules } from '../markdown/rules.react'; | ||||
import type { AppNavigationProp } from '../navigation/app-navigator.react'; | import type { AppNavigationProp } from '../navigation/app-navigator.react'; | ||||
import type { MessageTooltipRouteNames } from '../navigation/route-names'; | import type { MessageTooltipRouteNames } from '../navigation/route-names'; | ||||
import type { TooltipRoute } from '../navigation/tooltip.react'; | import type { TooltipRoute } from '../navigation/tooltip.react'; | ||||
import { useSelector } from '../redux/redux-utils'; | import { useSelector } from '../redux/redux-utils'; | ||||
import type { ChatMessageInfoItemWithHeight } from '../types/chat-types'; | import type { ChatMessageInfoItemWithHeight } from '../types/chat-types'; | ||||
Show All 23 Lines | return createPendingSidebar( | ||||
viewerID, | viewerID, | ||||
getDefaultTextMessageRules().simpleMarkdownRules, | getDefaultTextMessageRules().simpleMarkdownRules, | ||||
); | ); | ||||
} | } | ||||
function navigateToSidebar<RouteName: MessageTooltipRouteNames>( | function navigateToSidebar<RouteName: MessageTooltipRouteNames>( | ||||
route: TooltipRoute<RouteName>, | route: TooltipRoute<RouteName>, | ||||
dispatchFunctions: DispatchFunctions, | dispatchFunctions: DispatchFunctions, | ||||
bindServerCall: <F>(serverCall: ActionFunc<F>) => F, | bindServerCall: BindServerCall, | ||||
inputState: ?InputState, | inputState: ?InputState, | ||||
navigation: AppNavigationProp<RouteName>, | navigation: AppNavigationProp<RouteName>, | ||||
viewerID: ?string, | viewerID: ?string, | ||||
chatContext: ?ChatContextType, | chatContext: ?ChatContextType, | ||||
) { | ) { | ||||
invariant(viewerID, 'viewerID should be set'); | invariant(viewerID, 'viewerID should be set'); | ||||
const threadInfo = getSidebarThreadInfo(route.params.item, viewerID); | const threadInfo = getSidebarThreadInfo(route.params.item, viewerID); | ||||
invariant(threadInfo, 'threadInfo should be set'); | invariant(threadInfo, 'threadInfo should be set'); | ||||
Show All 23 Lines |