소스 검색

fix(rn,dialin-summary) simplify navigation

Only havee the screen in the hierarchy if we have a welcome page, since
it's the only way to access it.

Use goBack() from the navigator directly and avoid duplicating all props
to the screen.
master
Saúl Ibarra Corretgé 3 년 전
부모
커밋
fe7327cd21

+ 9
- 18
react/features/invite/components/dial-in-summary/native/DialInSummary.js 파일 보기

@@ -1,6 +1,6 @@
1 1
 // @flow
2 2
 
3
-import React, { Component } from 'react';
3
+import React, { PureComponent } from 'react';
4 4
 import { Linking, Platform, View } from 'react-native';
5 5
 import { WebView } from 'react-native-webview';
6 6
 import { type Dispatch } from 'redux';
@@ -13,8 +13,6 @@ import { LoadingIndicator } from '../../../../base/react';
13 13
 import { connect } from '../../../../base/redux';
14 14
 import HeaderNavigationButton
15 15
     from '../../../../mobile/navigation/components/HeaderNavigationButton';
16
-import { navigateRoot } from '../../../../mobile/navigation/rootNavigationContainerRef';
17
-import { screen } from '../../../../mobile/navigation/routes';
18 16
 import { getDialInfoPageURLForURIString } from '../../../functions';
19 17
 
20 18
 import DialInSummaryErrorDialog from './DialInSummaryErrorDialog';
@@ -43,7 +41,7 @@ type Props = {
43 41
 /**
44 42
  * Implements a React native component that displays the dial in info page for a specific room.
45 43
  */
46
-class DialInSummary extends Component<Props> {
44
+class DialInSummary extends PureComponent<Props> {
47 45
 
48 46
     /**
49 47
      * Initializes a new instance.
@@ -53,7 +51,6 @@ class DialInSummary extends Component<Props> {
53 51
     constructor(props: Props) {
54 52
         super(props);
55 53
 
56
-        this._onNavigateToRoot = this._onNavigateToRoot.bind(this);
57 54
         this._onError = this._onError.bind(this);
58 55
         this._onNavigate = this._onNavigate.bind(this);
59 56
         this._renderLoading = this._renderLoading.bind(this);
@@ -68,6 +65,9 @@ class DialInSummary extends Component<Props> {
68 65
      */
69 66
     componentDidMount() {
70 67
         const { navigation, t } = this.props;
68
+        const onNavigationClose = () => {
69
+            navigation.goBack();
70
+        };
71 71
 
72 72
         navigation.setOptions({
73 73
             headerLeft: () => {
@@ -75,13 +75,15 @@ class DialInSummary extends Component<Props> {
75 75
                     return (
76 76
                         <HeaderNavigationButton
77 77
                             label = { t('dialog.close') }
78
-                            onPress = { this._onNavigateToRoot } />
78
+                            // eslint-disable-next-line react/jsx-no-bind
79
+                            onPress = { onNavigationClose } />
79 80
                     );
80 81
                 }
81 82
 
82 83
                 return (
83 84
                     <HeaderNavigationButton
84
-                        onPress = { this._onNavigateToRoot }
85
+                        // eslint-disable-next-line react/jsx-no-bind
86
+                        onPress = { onNavigationClose }
85 87
                         src = { IconClose } />
86 88
                 );
87 89
             }
@@ -112,17 +114,6 @@ class DialInSummary extends Component<Props> {
112 114
         );
113 115
     }
114 116
 
115
-    _onNavigateToRoot: () => void;
116
-
117
-    /**
118
-     * Callback to handle navigation back to root.
119
-     *
120
-     * @returns {void}
121
-     */
122
-    _onNavigateToRoot() {
123
-        navigateRoot(screen.root);
124
-    }
125
-
126 117
     _onError: () => void;
127 118
 
128 119
     /**

+ 10
- 8
react/features/mobile/navigation/components/RootNavigationContainer.js 파일 보기

@@ -45,10 +45,16 @@ const RootNavigationContainer = ({ isWelcomePageAvailable }: Props) => {
45 45
                     initialRouteName = { initialRouteName }>
46 46
                     {
47 47
                         isWelcomePageAvailable
48
-                            && <RootStack.Screen
49
-                                component = { WelcomePageNavigationContainer }
50
-                                name = { screen.root }
51
-                                options = { drawerNavigatorScreenOptions } />
48
+                            && <>
49
+                                <RootStack.Screen
50
+                                    component = { WelcomePageNavigationContainer }
51
+                                    name = { screen.root }
52
+                                    options = { drawerNavigatorScreenOptions } />
53
+                                <RootStack.Screen
54
+                                    component = { DialInSummary }
55
+                                    name = { screen.dialInSummary }
56
+                                    options = { dialInSummaryScreenOptions } />
57
+                            </>
52 58
                     }
53 59
                     <RootStack.Screen
54 60
                         component = { ConnectingPage }
@@ -57,10 +63,6 @@ const RootNavigationContainer = ({ isWelcomePageAvailable }: Props) => {
57 63
                             gestureEnabled: false,
58 64
                             headerShown: false
59 65
                         }} />
60
-                    <RootStack.Screen
61
-                        component = { DialInSummary }
62
-                        name = { screen.dialInSummary }
63
-                        options = { dialInSummaryScreenOptions } />
64 66
                     <RootStack.Screen
65 67
                         component = { ConferenceNavigationContainer }
66 68
                         name = { screen.conference.root }

+ 8
- 15
react/features/mobile/navigation/screenOptions.js 파일 보기

@@ -43,21 +43,6 @@ export const fullScreenOptions = {
43 43
 };
44 44
 
45 45
 
46
-/**
47
- * Dial-IN Info screen options and transition types.
48
- */
49
-export const dialInSummaryScreenOptions = {
50
-    ...TransitionPresets.ModalTransition,
51
-    gestureEnabled: true,
52
-    headerShown: true,
53
-    headerStyle: {
54
-        backgroundColor: BaseTheme.palette.screen02Header
55
-    },
56
-    headerTitleStyle: {
57
-        color: BaseTheme.palette.text01
58
-    }
59
-};
60
-
61 46
 /**
62 47
  * Drawer navigator screens options and transition types.
63 48
  */
@@ -203,6 +188,14 @@ export const presentationScreenOptions = {
203 188
  */
204 189
 export const chatScreenOptions = presentationScreenOptions;
205 190
 
191
+/**
192
+ * Dial-IN Info screen options and transition types.
193
+ */
194
+export const dialInSummaryScreenOptions = {
195
+    ...presentationScreenOptions,
196
+    headerLeft: undefined
197
+};
198
+
206 199
 /**
207 200
  * Screen options for invite modal.
208 201
  */

Loading…
취소
저장