mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-06 02:40:15 +00:00
30 lines
967 B
TypeScript
30 lines
967 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Redirect, type Href} from 'expo-router';
|
|
import {useEffect, useState} from 'react';
|
|
|
|
import {determineInitialExpoRoute, type ExpoRouterLaunchResult} from '@init/launch';
|
|
import {propsToParams} from '@screens/navigation';
|
|
|
|
export default function RootIndex() {
|
|
const [launchResult, setLaunchResult] = useState<ExpoRouterLaunchResult | null>(null);
|
|
|
|
useEffect(() => {
|
|
async function initializeLaunch() {
|
|
const result = await determineInitialExpoRoute();
|
|
setLaunchResult(result);
|
|
}
|
|
|
|
initializeLaunch();
|
|
}, []);
|
|
|
|
if (!launchResult) {
|
|
return null; // Still determining initial route
|
|
}
|
|
|
|
// Redirect to the determined route with params
|
|
const href: Href = {pathname: launchResult.route, params: propsToParams(launchResult.params)};
|
|
return <Redirect href={href}/>;
|
|
}
|