ソースを参照

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
 // @flow
1
 // @flow
2
 
2
 
3
-import React, { Component } from 'react';
3
+import React, { PureComponent } from 'react';
4
 import { Linking, Platform, View } from 'react-native';
4
 import { Linking, Platform, View } from 'react-native';
5
 import { WebView } from 'react-native-webview';
5
 import { WebView } from 'react-native-webview';
6
 import { type Dispatch } from 'redux';
6
 import { type Dispatch } from 'redux';
13
 import { connect } from '../../../../base/redux';
13
 import { connect } from '../../../../base/redux';
14
 import HeaderNavigationButton
14
 import HeaderNavigationButton
15
     from '../../../../mobile/navigation/components/HeaderNavigationButton';
15
     from '../../../../mobile/navigation/components/HeaderNavigationButton';
16
-import { navigateRoot } from '../../../../mobile/navigation/rootNavigationContainerRef';
17
-import { screen } from '../../../../mobile/navigation/routes';
18
 import { getDialInfoPageURLForURIString } from '../../../functions';
16
 import { getDialInfoPageURLForURIString } from '../../../functions';
19
 
17
 
20
 import DialInSummaryErrorDialog from './DialInSummaryErrorDialog';
18
 import DialInSummaryErrorDialog from './DialInSummaryErrorDialog';
43
 /**
41
 /**
44
  * Implements a React native component that displays the dial in info page for a specific room.
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
      * Initializes a new instance.
47
      * Initializes a new instance.
53
     constructor(props: Props) {
51
     constructor(props: Props) {
54
         super(props);
52
         super(props);
55
 
53
 
56
-        this._onNavigateToRoot = this._onNavigateToRoot.bind(this);
57
         this._onError = this._onError.bind(this);
54
         this._onError = this._onError.bind(this);
58
         this._onNavigate = this._onNavigate.bind(this);
55
         this._onNavigate = this._onNavigate.bind(this);
59
         this._renderLoading = this._renderLoading.bind(this);
56
         this._renderLoading = this._renderLoading.bind(this);
68
      */
65
      */
69
     componentDidMount() {
66
     componentDidMount() {
70
         const { navigation, t } = this.props;
67
         const { navigation, t } = this.props;
68
+        const onNavigationClose = () => {
69
+            navigation.goBack();
70
+        };
71
 
71
 
72
         navigation.setOptions({
72
         navigation.setOptions({
73
             headerLeft: () => {
73
             headerLeft: () => {
75
                     return (
75
                     return (
76
                         <HeaderNavigationButton
76
                         <HeaderNavigationButton
77
                             label = { t('dialog.close') }
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
                 return (
83
                 return (
83
                     <HeaderNavigationButton
84
                     <HeaderNavigationButton
84
-                        onPress = { this._onNavigateToRoot }
85
+                        // eslint-disable-next-line react/jsx-no-bind
86
+                        onPress = { onNavigationClose }
85
                         src = { IconClose } />
87
                         src = { IconClose } />
86
                 );
88
                 );
87
             }
89
             }
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
     _onError: () => void;
117
     _onError: () => void;
127
 
118
 
128
     /**
119
     /**

+ 10
- 8
react/features/mobile/navigation/components/RootNavigationContainer.js ファイルの表示

45
                     initialRouteName = { initialRouteName }>
45
                     initialRouteName = { initialRouteName }>
46
                     {
46
                     {
47
                         isWelcomePageAvailable
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
                     <RootStack.Screen
59
                     <RootStack.Screen
54
                         component = { ConnectingPage }
60
                         component = { ConnectingPage }
57
                             gestureEnabled: false,
63
                             gestureEnabled: false,
58
                             headerShown: false
64
                             headerShown: false
59
                         }} />
65
                         }} />
60
-                    <RootStack.Screen
61
-                        component = { DialInSummary }
62
-                        name = { screen.dialInSummary }
63
-                        options = { dialInSummaryScreenOptions } />
64
                     <RootStack.Screen
66
                     <RootStack.Screen
65
                         component = { ConferenceNavigationContainer }
67
                         component = { ConferenceNavigationContainer }
66
                         name = { screen.conference.root }
68
                         name = { screen.conference.root }

+ 8
- 15
react/features/mobile/navigation/screenOptions.js ファイルの表示

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
  * Drawer navigator screens options and transition types.
47
  * Drawer navigator screens options and transition types.
63
  */
48
  */
203
  */
188
  */
204
 export const chatScreenOptions = presentationScreenOptions;
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
  * Screen options for invite modal.
200
  * Screen options for invite modal.
208
  */
201
  */

読み込み中…
キャンセル
保存