import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import React, { useCallback } from 'react'; import { connect } from '../../../base/redux'; import { DialInSummary } from '../../../invite'; import { _ROOT_NAVIGATION_READY } from '../actionTypes'; import { rootNavigationRef } from '../rootNavigationContainerRef'; import { screen } from '../routes'; import { dialInSummaryScreenOptions, drawerNavigatorScreenOptions, navigationContainerTheme } from '../screenOptions'; import ConnectingPage from './ConnectingPage'; import ConferenceNavigationContainer from './conference/components/ConferenceNavigationContainer'; import WelcomePageNavigationContainer from './welcome/components/WelcomePageNavigationContainer'; import { isWelcomePageAppEnabled } from './welcome/functions'; const RootStack = createNativeStackNavigator(); type Props = { /** * Redux dispatch function. */ dispatch: Function, /** * Is welcome page available? */ isWelcomePageAvailable: boolean } const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: Props) => { const initialRouteName = isWelcomePageAvailable ? screen.root : screen.connecting; const onReady = useCallback(() => { dispatch({ type: _ROOT_NAVIGATION_READY, ready: true }); }, [ dispatch ]); return ( { isWelcomePageAvailable && <> } ); }; /** * Maps part of the Redux store to the props of this component. * * @param {Object} state - The Redux state. * @returns {Props} */ function mapStateToProps(state: Object) { return { isWelcomePageAvailable: isWelcomePageAppEnabled(state) }; } export default connect(mapStateToProps)(RootNavigationContainer);