1 | import { NavigationActions, getNavigation } from '@react-navigation/core';
|
2 |
|
3 | export default function handleServerRequest(Router, pathWithLeadingSlash, query) {
|
4 | const path = pathWithLeadingSlash.slice(1);
|
5 |
|
6 |
|
7 | const navigationAction = Router.getActionForPathAndParams(path, query) || NavigationActions.init();
|
8 |
|
9 |
|
10 | const navigationState = Router.getStateForAction(navigationAction);
|
11 |
|
12 | const actionSubscribers = new Set();
|
13 | const navigation = getNavigation(Router, navigationState, () => {}, actionSubscribers, () => ({}), () => navigation);
|
14 |
|
15 | const activeKey = navigationState.routes[navigationState.index].key;
|
16 | const activeChildNavigation = navigation.getChildNavigation(activeKey);
|
17 | const options = Router.getScreenOptions(activeChildNavigation);
|
18 | const title = options.title || options.headerTitle;
|
19 |
|
20 | return { navigation, title };
|
21 | } |
\ | No newline at end of file |