@@ -10,10 +10,16 @@ import {
1010 PartialState ,
1111 DefaultTheme ,
1212 Route ,
13- RouteProp
13+ RouteProp ,
14+ NavigationProp
1415} from '@react-navigation/native'
1516import { createNativeStackNavigator , NativeStackNavigationOptions } from '@react-navigation/native-stack'
16- import { createDrawerNavigator } from '@react-navigation/drawer'
17+ import {
18+ createDrawerNavigator ,
19+ DrawerNavigationProp ,
20+ getDrawerStatusFromState ,
21+ useDrawerStatus
22+ } from '@react-navigation/drawer'
1723import { ToastProvider } from '@src/components/toast'
1824import { useAppSelector } from '@src/hooks'
1925import { useUnRead } from '@src/hooks/useUnRead'
@@ -113,10 +119,14 @@ const getHeaderTitle = (
113119 // If the focused route is not found, we need to assume it's the initial screen
114120 // This can happen during if there hasn't been any navigation inside the screen
115121 // In our case, it's "Feed" as that's the first screen inside the navigator
116- const routeName = getFocusedRouteNameFromRoute ( route ) ?? ROUTES . HotDraw
122+ const routeName = getFocusedRouteNameFromRoute ( route ) ?? ROUTES . Hot
117123 switch ( routeName ) {
118124 case ROUTES . HotDraw :
119125 return translate ( `router.${ ROUTES . Hot } ` )
126+ case ROUTES . Hot :
127+ return translate ( `router.${ ROUTES . Hot } ` )
128+ case ROUTES . Latest :
129+ return translate ( `router.${ ROUTES . Latest } ` )
120130 case ROUTES . Nodes :
121131 return translate ( `router.${ ROUTES . Nodes } ` )
122132 case ROUTES . Notifications :
@@ -179,17 +189,43 @@ const HotDrawerNavigator = (initialRouteName?: string) => {
179189 )
180190}
181191
182- const MainBottomHeaderLeft = ( { route } : { route : RouteProp < RootStackParamList > } ) : ReactNode => {
192+ const MainBottomHeaderLeft = ( {
193+ navigation,
194+ route
195+ } : {
196+ route : RouteProp < RootStackParamList >
197+ navigation : NavigationProp < RootStackParamList >
198+ } ) : ReactNode => {
183199 const { theme } = useTheme ( )
184200 const focusRouteName = getFocusedRouteNameFromRoute ( route ) ?? ROUTES . HotDraw
185- return focusRouteName === ROUTES . HotDraw ? < HeaderButton source = { theme . assets . images . icons . header . more } /> : undefined
201+ return focusRouteName === ROUTES . HotDraw ? (
202+ < HeaderButton
203+ source = { theme . assets . images . icons . header . more }
204+ onPress = { ( ) => {
205+ console . log ( getFocusedRouteNameFromRoute ( route ) )
206+ } }
207+ />
208+ ) : undefined
186209}
187210
188- const MainBottomTabHeaderRight = ( { route } : { route : RouteProp < RootStackParamList > } ) : ReactNode => {
211+ const MainBottomTabHeaderRight = ( {
212+ navigation,
213+ route
214+ } : {
215+ route : RouteProp < RootStackParamList >
216+ navigation : NavigationProp < RootStackParamList >
217+ } ) : ReactNode => {
189218 const { theme } = useTheme ( )
190219
191220 const focusRouteName = getFocusedRouteNameFromRoute ( route ) ?? ROUTES . HotDraw
192- return focusRouteName === ROUTES . HotDraw ? < HeaderButton source = { theme . assets . images . icons . header . stat } /> : undefined
221+ return focusRouteName === ROUTES . HotDraw ? (
222+ < HeaderButton
223+ source = { theme . assets . images . icons . header . stat }
224+ onPress = { ( ) => {
225+ NavigationService . navigate ( ROUTES . SiteStat )
226+ } }
227+ />
228+ ) : undefined
193229}
194230
195231const MainAppNavigator = ( { navigation, route } : MainScreenProps ) => {
@@ -346,13 +382,13 @@ export const AppNavigationContainer = () => {
346382 < StackNavigator . Screen
347383 name = { ROUTES . Main }
348384 component = { MainAppNavigator }
349- options = { ( { route } ) => ( {
385+ options = { ( { route, navigation } ) => ( {
350386 ...defaultScreenOptions ( theme ) ,
351387 headerShadowVisible : ! [ ROUTES . HotDraw ] . includes (
352388 getFocusedRouteNameFromRoute ( route ) ?? ( ROUTES . Nodes as any )
353389 ) ,
354- headerLeft : ( ) => MainBottomHeaderLeft ( { route } ) ,
355- headerRight : ( ) => MainBottomTabHeaderRight ( { route } ) ,
390+ headerLeft : ( ) => MainBottomHeaderLeft ( { route, navigation } ) ,
391+ headerRight : ( ) => MainBottomTabHeaderRight ( { route, navigation } ) ,
356392 headerTitle : getHeaderTitle ( route )
357393 } ) }
358394 initialParams = { {
0 commit comments