Преглед изворни кода

feat(rnsdk) share bootsrap code with app

factor2
Saúl Ibarra Corretgé пре 1 година
родитељ
комит
c83c4488bf

+ 5
- 11
react-native-sdk/index.tsx Прегледај датотеку

@@ -1,10 +1,7 @@
1 1
 /* eslint-disable lines-around-comment,  no-undef, no-unused-vars  */
2 2
 
3
-import 'react-native-gesture-handler';
4
-// Apply all necessary polyfills as early as possible
5
-// to make sure anything imported henceforth sees them.
6
-import 'react-native-get-random-values';
7
-import './react/features/mobile/polyfills';
3
+// NB: This import must always come first.
4
+import './react/bootstrap.native';
8 5
 
9 6
 import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
10 7
 import { View, ViewStyle } from 'react-native';
@@ -12,7 +9,6 @@ import { View, ViewStyle } from 'react-native';
12 9
 import { appNavigate } from './react/features/app/actions.native';
13 10
 import { App } from './react/features/app/components/App.native';
14 11
 import { setAudioMuted, setVideoMuted } from './react/features/base/media/actions';
15
-import JitsiThemePaperProvider from './react/features/base/ui/components/JitsiThemeProvider.native';
16 12
 
17 13
 
18 14
 interface IEventListeners {
@@ -117,11 +113,9 @@ export const JitsiMeeting = forwardRef((props: IAppProps, ref) => {
117 113
 
118 114
     return (
119 115
         <View style = { style as ViewStyle }>
120
-            <JitsiThemePaperProvider>
121
-                <App
122
-                    { ...appProps }
123
-                    ref = { app } />
124
-            </JitsiThemePaperProvider>
116
+            <App
117
+                { ...appProps }
118
+                ref = { app } />
125 119
         </View>
126 120
     );
127 121
 });

+ 7
- 0
react/bootstrap.native.js Прегледај датотеку

@@ -0,0 +1,7 @@
1
+// https://github.com/software-mansion/react-native-gesture-handler/issues/320#issuecomment-443815828
2
+import 'react-native-gesture-handler';
3
+
4
+// Apply all necessary polyfills as early as possible to make sure anything imported henceforth
5
+// sees them.
6
+import 'react-native-get-random-values';
7
+import './features/mobile/polyfills';

+ 15
- 0
react/features/app/components/App.native.tsx Прегледај датотеку

@@ -12,6 +12,7 @@ import { getFeatureFlag } from '../../base/flags/functions';
12 12
 import { clientResized, setSafeAreaInsets } from '../../base/responsive-ui/actions';
13 13
 import DimensionsDetector from '../../base/responsive-ui/components/DimensionsDetector.native';
14 14
 import { updateSettings } from '../../base/settings/actions';
15
+import JitsiThemePaperProvider from '../../base/ui/components/JitsiThemeProvider.native';
15 16
 import { _getRouteToRender } from '../getRouteToRender.native';
16 17
 import logger from '../logger';
17 18
 
@@ -89,6 +90,20 @@ export class App extends AbstractApp<IProps> {
89 90
         logger.info(`Loaded SDK ${AppInfo.sdkVersion}${liteTxt}`);
90 91
     }
91 92
 
93
+    /**
94
+     * Implements React's {@link Component#render()}.
95
+     *
96
+     * @inheritdoc
97
+     * @returns {ReactElement}
98
+     */
99
+    render() {
100
+        return (
101
+            <JitsiThemePaperProvider>
102
+                { super.render() }
103
+            </JitsiThemePaperProvider>
104
+        );
105
+    }
106
+
92 107
     /**
93 108
      * Initializes feature flags and updates settings.
94 109
      *

+ 3
- 12
react/index.native.js Прегледај датотеку

@@ -1,17 +1,11 @@
1
-// https://github.com/software-mansion/react-native-gesture-handler/issues/320#issuecomment-443815828
2
-import 'react-native-gesture-handler';
3
-
4
-// Apply all necessary polyfills as early as possible to make sure anything imported henceforth
5
-// sees them.
6
-import 'react-native-get-random-values';
7
-import './features/mobile/polyfills';
1
+// NB: This import must always come first.
2
+import './bootstrap.native';
8 3
 
9 4
 import React, { PureComponent } from 'react';
10 5
 import { AppRegistry } from 'react-native';
11 6
 
12 7
 import { App } from './features/app/components/App.native';
13 8
 import { _initLogging } from './features/base/logging/functions';
14
-import JitsiThemePaperProvider from './features/base/ui/components/JitsiThemeProvider';
15 9
 
16 10
 /**
17 11
  * React Native doesn't support specifying props to the main/root component (in
@@ -29,10 +23,7 @@ class Root extends PureComponent {
29 23
      */
30 24
     render() {
31 25
         return (
32
-            <JitsiThemePaperProvider>
33
-                <App
34
-                    { ...this.props } />
35
-            </JitsiThemePaperProvider>
26
+            <App { ...this.props } />
36 27
         );
37 28
     }
38 29
 }

Loading…
Откажи
Сачувај