You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RootNavigationContainer.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // @flow
  2. import { NavigationContainer } from '@react-navigation/native';
  3. import { createStackNavigator } from '@react-navigation/stack';
  4. import React from 'react';
  5. import { SafeAreaProvider } from 'react-native-safe-area-context';
  6. import { connect } from '../../base/redux';
  7. import {
  8. dialInSummaryScreenOptions,
  9. drawerNavigatorScreenOptions,
  10. navigationContainerTheme
  11. } from '../../conference/components/native/ConferenceNavigatorScreenOptions';
  12. import { screen } from '../../conference/components/native/routes';
  13. import { DialInSummary } from '../../invite';
  14. import { isWelcomePageAppEnabled } from '../functions.native';
  15. import BlankPage from './BlankPage';
  16. import { rootNavigationRef } from './RootNavigationContainerRef';
  17. import WelcomePageNavigationContainer from './WelcomePageNavigationContainer';
  18. const RootStack = createStackNavigator();
  19. type Props = {
  20. /**
  21. * Is welcome page available?
  22. */
  23. isWelcomePageAvailable: boolean
  24. }
  25. const RootNavigationContainer = ({ isWelcomePageAvailable }: Props) => (
  26. <SafeAreaProvider>
  27. <NavigationContainer
  28. independent = { true }
  29. ref = { rootNavigationRef }
  30. theme = { navigationContainerTheme }>
  31. <RootStack.Navigator
  32. initialRouteName = { screen.root }>
  33. {
  34. isWelcomePageAvailable
  35. ? <RootStack.Screen
  36. component = { WelcomePageNavigationContainer }
  37. name = { screen.root }
  38. options = { drawerNavigatorScreenOptions } />
  39. : <RootStack.Screen
  40. component = { BlankPage }
  41. name = { screen.root } />
  42. }
  43. <RootStack.Screen
  44. component = { DialInSummary }
  45. name = { screen.dialInSummary }
  46. options = { dialInSummaryScreenOptions } />
  47. </RootStack.Navigator>
  48. </NavigationContainer>
  49. </SafeAreaProvider>
  50. );
  51. /**
  52. * Maps part of the Redux store to the props of this component.
  53. *
  54. * @param {Object} state - The Redux state.
  55. * @returns {Props}
  56. */
  57. function mapStateToProps(state: Object) {
  58. return {
  59. isWelcomePageAvailable: isWelcomePageAppEnabled(state)
  60. };
  61. }
  62. export default connect(mapStateToProps)(RootNavigationContainer);