Skip to content

Commit 71e8681

Browse files
WIP
1 parent 91fdab3 commit 71e8681

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

shared/constants/types/router.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type ScreenProps<RouteName extends string = string> = {
1616

1717
export type ScreenComponentProps = {
1818
route: {params: any}
19-
navigation: NativeStackNavigationProp<ParamListBase, string>
19+
navigation: NativeStackNavigationProp<ParamListBase>
2020
}
2121
// Properties consumed by our layout functions (not React Navigation)
2222
export type LayoutOptions = {

shared/router-v2/screen-layout.desktop.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const ModalHeader = (props: ModalHeaderProps) => (
3636
const mouseResetValue = -9999
3737
const mouseDistanceThreshold = 5
3838

39-
const useMouseClick = (navigation: NativeStackNavigationProp<KBRootParamList>, noClose?: boolean) => {
39+
const useMouseClick = (navigation: NativeStackNavigationProp<ParamListBase>, noClose?: boolean) => {
4040
const backgroundRef = React.useRef<HTMLDivElement>(null)
4141
// we keep track of mouse down/up to determine if we should call it a 'click'. We don't want dragging the
4242
// window around to count
@@ -71,7 +71,7 @@ const useMouseClick = (navigation: NativeStackNavigationProp<KBRootParamList>, n
7171
type ModalWrapperProps = {
7272
children: React.ReactNode
7373
navigationOptions?: GetOptionsRet
74-
navigation: NativeStackNavigationProp<ParamListBase, string>
74+
navigation: NativeStackNavigationProp<ParamListBase>
7575
}
7676

7777
const ModalWrapper = (p: ModalWrapperProps) => {

shared/teams/container.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import * as C from '@/constants'
22
import * as Teams from '@/stores/teams'
33
import * as Kb from '@/common-adapters'
44
import type * as T from '@/constants/types'
5-
import type {RouteProps2} from '@/router-v2/route-params'
5+
import type {RootParamList} from '@/router-v2/route-params'
66
import Main from './main'
77
import {useTeamsSubscribe} from './subscriber'
88
import {useActivityLevels} from './common'
99
import {useSafeNavigation} from '@/util/safe-navigation'
10+
import {useNavigation} from '@react-navigation/native'
11+
import type {NativeStackNavigationProp} from '@react-navigation/native-stack'
1012

1113
const orderTeams = (
1214
teams: ReadonlyMap<string, T.Teams.TeamMeta>,
@@ -43,11 +45,12 @@ const orderTeams = (
4345
})
4446
}
4547

46-
type Props = RouteProps2<'teamsRoot'>
48+
type Props = {
49+
filter?: string
50+
sort?: T.Teams.TeamListSort
51+
}
4752

48-
const Connected = ({navigation, route}: Props) => {
49-
const filter = route.params?.filter ?? ''
50-
const sort = route.params?.sort ?? 'role'
53+
const Connected = ({filter = '', sort = 'role'}: Props) => {
5154
const data = Teams.useTeamsState(
5255
C.useShallow(s => {
5356
const {deletedTeams, activityLevels, teamMeta, dispatch} = s
@@ -77,6 +80,7 @@ const Connected = ({navigation, route}: Props) => {
7780
useActivityLevels(true)
7881

7982
const nav = useSafeNavigation()
83+
const navigation = useNavigation<NativeStackNavigationProp<RootParamList, 'teamsRoot'>>()
8084
const onCreateTeam = () => launchNewTeamWizardOrModal()
8185
const onJoinTeam = () => nav.safeNavigateAppend('teamJoinTeamDialog')
8286

@@ -86,7 +90,7 @@ const Connected = ({navigation, route}: Props) => {
8690
onCreateTeam={onCreateTeam}
8791
onJoinTeam={onJoinTeam}
8892
deletedTeams={deletedTeams}
89-
onChangeSort={sortOrder => navigation.setParams({...(route.params ?? {}), filter, sort: sortOrder})}
93+
onChangeSort={sortOrder => navigation.setParams({filter, sort: sortOrder})}
9094
sortOrder={sort}
9195
teams={teams}
9296
/>

shared/teams/routes.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,9 @@ export const newRoutes = {
209209
React.lazy(async () => import('./team/member/index.new')),
210210
{getOptions: {headerShadowVisible: false, headerTitle: ''}}
211211
),
212-
teamsRoot: {
212+
teamsRoot: C.makeScreen(React.lazy(async () => import('./container')), {
213213
getOptions: teamsRootGetOptions,
214-
screen: React.lazy(async () => import('./container')),
215-
},
214+
}),
216215
}
217216

218217
export const newModalRoutes = {

0 commit comments

Comments
 (0)