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.

ConferenceNavigationContainer.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 { useSelector } from 'react-redux';
  7. import { Chat, ChatAndPolls } from '../../../chat';
  8. import { SharedDocument } from '../../../etherpad';
  9. import AddPeopleDialog
  10. from '../../../invite/components/add-people-dialog/native/AddPeopleDialog';
  11. import LobbyScreen from '../../../lobby/components/native/LobbyScreen';
  12. import { ParticipantsPane } from '../../../participants-pane/components/native';
  13. import { getDisablePolls } from '../../functions';
  14. import Conference from './Conference';
  15. import {
  16. conferenceNavigationRef
  17. } from './ConferenceNavigationContainerRef';
  18. import {
  19. chatScreenOptions,
  20. conferenceScreenOptions,
  21. inviteScreenOptions,
  22. lobbyScreenOptions,
  23. participantsScreenOptions,
  24. sharedDocumentScreenOptions
  25. } from './ConferenceNavigatorScreenOptions';
  26. import { screen } from './routes';
  27. const ConferenceStack = createStackNavigator();
  28. const ConferenceNavigationContainer = () => {
  29. const isPollsDisabled = useSelector(getDisablePolls);
  30. const ChatScreen
  31. = isPollsDisabled
  32. ? Chat
  33. : ChatAndPolls;
  34. const chatScreenName
  35. = isPollsDisabled
  36. ? screen.conference.chat
  37. : screen.conference.chatandpolls.main;
  38. return (
  39. <SafeAreaProvider>
  40. <NavigationContainer
  41. independent = { true }
  42. ref = { conferenceNavigationRef }
  43. theme = {{
  44. colors: {
  45. background: '#fff'
  46. }
  47. }}>
  48. <ConferenceStack.Navigator
  49. initialRouteName = { screen.conference.main }
  50. mode = 'modal'>
  51. <ConferenceStack.Screen
  52. component = { Conference }
  53. name = { screen.conference.main }
  54. options = {{
  55. ...conferenceScreenOptions
  56. }} />
  57. <ConferenceStack.Screen
  58. /* eslint-disable-next-line react/jsx-no-bind */
  59. component = { ChatScreen }
  60. name = { chatScreenName }
  61. options = {{
  62. ...chatScreenOptions
  63. }} />
  64. <ConferenceStack.Screen
  65. component = { ParticipantsPane }
  66. name = { screen.conference.participants }
  67. options = {{
  68. ...participantsScreenOptions
  69. }} />
  70. <ConferenceStack.Screen
  71. component = { LobbyScreen }
  72. name = { screen.lobby }
  73. options = {{
  74. ...lobbyScreenOptions
  75. }} />
  76. <ConferenceStack.Screen
  77. component = { AddPeopleDialog }
  78. name = { screen.conference.invite }
  79. options = {{
  80. ...inviteScreenOptions
  81. }} />
  82. <ConferenceStack.Screen
  83. component = { SharedDocument }
  84. name = { screen.conference.sharedDocument }
  85. options = {{
  86. ...sharedDocumentScreenOptions
  87. }} />
  88. </ConferenceStack.Navigator>
  89. </NavigationContainer>
  90. </SafeAreaProvider>
  91. );
  92. };
  93. export default ConferenceNavigationContainer;